home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Standards 1994 January / InfoMagic Standards - January 1994.iso / ccitt / 1988 / troff / 8_4_03.tro < prev    next >
Text File  |  1991-12-22  |  130KB  |  6,030 lines

  1. .rs
  2. .\" Troff code generated by TPS Convert from ITU Original Files
  3. .\"                 Not Copyright (~c) 1991 
  4. .\"
  5. .\" Assumes tbl, eqn, MS macros, and lots of luck.
  6. .TA 1c 2c 3c 4c 5c 6c 7c 8c
  7. .ds CH
  8. .ds CF
  9. .EQ
  10. delim @@
  11. .EN
  12. .nr LL 40.5P
  13. .nr ll 40.5P
  14. .nr HM 3P
  15. .nr FM 6P
  16. .nr PO 4P
  17. .nr PD 9p
  18. .po 4P
  19.  
  20. .rs
  21. \v'|.5i'
  22. .ce 1000
  23. ANNEX\ A
  24. .ce 0
  25. .ce 1000
  26. (to Recommendation X.208)
  27. .EF '%    Fascicle\ VIII.4\ \(em\ Rec.\ X.208''
  28. .OF '''Fascicle\ VIII.4\ \(em\ Rec.\ X.208    %'
  29. .sp 9p
  30. .RT
  31. .ce 0
  32. .ce 1000
  33. \fBThe\fR 
  34. \fBmacro notation\fR 
  35. .sp 1P
  36. .RT
  37. .ce 0
  38. .LP
  39. A.1
  40.     \fIIntroduction\fR 
  41. .sp 1P
  42. .RT
  43. .PP
  44. A mechanism is provided within ASN.1 for the user of ASN.1 to
  45. define a new notation with which he can then construct and reference ASN.1
  46. types or specify values of types. The new notation is defined using the
  47. notation \*QMacroDefinition\*U. A \*QMacroDefinition\*U simultaneously 
  48. specifies a new notation for constructing and referencing a type and also 
  49. a new notation for 
  50. specifying a value. (See \(sc\ I.3 for an illustration of the use of the macro
  51. notation.)
  52. .PP
  53. With a \*QMacroDefinition\*U the ASN.1 user specifies the new notation 
  54. by means of a set of productions in a manner similar to that of this 
  55. Recommendation. The writer of the macro definition;
  56. .RT
  57. .LP
  58.     a)
  59.     specifies the complete syntax to be used for defining all
  60. types supported by the macro (this syntax specification is invoked
  61. for syntax analysis by any occurrence of the macro name in the ASN.1
  62. type notation); and
  63. .LP
  64.     b)
  65.     specifies the complete syntax to be used for a value of one
  66. of these types (this syntax specification is invoked for syntax
  67. analysis whenever a value of the macro type is expected); and
  68. .LP
  69.     c)
  70.     specifies, as the value of a standard ASN.1 type (of
  71. arbitrary complexity), the resulting type and value for all instances
  72. of the macro value notation.
  73. .PP
  74. An instance of the syntax defined by the macro definition can
  75. contain instances of types or values (using the standard ASN.1 notation). 
  76. These types or values (appearing in the use of macro notation) can be associated, 
  77. for the duration of the syntax analysis, with a \fBlocal type reference\fR 
  78. or a \fBlocal value reference\fR by appropriate statements in the macro 
  79. definition. It is also possible to embed, within the macro definition, 
  80. standard ASN.1 type 
  81. .PP
  82. assignments. These assignments become active when the associated syntactic
  83. category is matched against an item or items in the instance of the new
  84. notation being analysed. Their lifetime is limited to that of the analysis.
  85. .PP
  86. When analysing a value in the new notation, assignments made during
  87. analysis of the corresponding type notation are available. Such analysis is
  88. considered to logically precede analysis of every instance of the value
  89. notation.
  90. .PP
  91. The resulting type and value of an instance of use of the new value
  92. notation is determined by the value (and the type of the value) finally
  93. assigned to the distinguished local value reference identified by the keyword 
  94. item VALUE, according to the processing of the macrodefinition for the 
  95. new type notation followed by that for the new value notation. 
  96. .PP
  97. Each \*QMacroDefinition\*U defines a notation (a syntax) for type
  98. definition and a notation (a syntax) for value definition. The ASN.1 type 
  99. which is defined by an instance of the new type notation may, but need 
  100. not, depend on the instance of the value notation with which the type is 
  101. associated. To this extent, the use of the new type notation is similar 
  102. to a CHOICE\ \(em\ the tag is 
  103. indeterminate. Thus the new notation cannot in this case be used in places
  104. where a known tag is required, nor can it be implicitly tagged.
  105. .RT
  106. .sp 1P
  107. .LP
  108. A.2
  109.     \fIExtensions to the ASN.1 character set and items\fR 
  110. .sp 9p
  111. .RT
  112. .PP
  113. The characters | and > are used in the macro notation.
  114. .PP
  115. The items specified in the following subclauses are also used.
  116. .bp
  117. .RT
  118. .sp 1P
  119. .LP
  120. A.2.1
  121.     \fIMacroreference\fR 
  122. .sp 9p
  123. .RT
  124. .PP
  125. Name of item\ \(em\ macroreference
  126. .PP
  127. A <<macroreference>> shall consist of the sequence of characters
  128. specified for a \*Qtypereference\*U in \(sc\ 8.2, except that all characters 
  129. shall be in upper\(hycase. Within a single module, the same sequence of 
  130. characters shall 
  131. not be used for both a typereference and a macroreference.
  132. .RT
  133. .sp 1P
  134. .LP
  135. A.2.2
  136.     \fIProductionreference\fR 
  137. .sp 9p
  138. .RT
  139. .PP
  140. Name of item\ \(em\ productionreference
  141. .PP
  142. A <<productionreference>> shall consist of the sequence of characters
  143. specified for a \*Qtypereference\*U in \(sc\ 8.2.
  144. .RT
  145. .sp 1P
  146. .LP
  147. A.2.3
  148.     \fILocaltypereference\fR 
  149. .sp 9p
  150. .RT
  151. .PP
  152. Name of item\ \(em\ localtypereference
  153. .PP
  154. A \*Qlocaltypereference\*U shall consist of the sequence of characters
  155. specified for a \*Qtypereference\*U in \(sc\ 8.2. A \*Qlocaltypereference\*U 
  156. is used as an identifier for types which are recognized during syntax analysis 
  157. of an instance of the new type or value notation. 
  158. .RT
  159. .sp 1P
  160. .LP
  161. A.2.4
  162.     \fILocalvaluereference\fR 
  163. .sp 9p
  164. .RT
  165. .PP
  166. Name of item\ \(em\ localvaluereference
  167. .PP
  168. A \*Qlocalvaluereference\*U shall consist of the sequence of characters
  169. specified for a \*Qvaluereference\*U in \(sc\ 8.2. A \*Qlocalvaluereference\*U 
  170. is used as an identifier for values which are recognized during syntax 
  171. analysis of an 
  172. instance of the new type or value notation.
  173. .RT
  174. .sp 1P
  175. .LP
  176. A.2.5
  177.     \fIAlternation item\fR 
  178. .sp 9p
  179. .RT
  180. .PP
  181. Name of item\ \(em\ \*Q\ |\ \*U
  182. .PP
  183. This item shall consist of the single character\ |
  184. .
  185. .RT
  186. .sp 1P
  187. .LP
  188. A.2.6
  189.     \fIDefinition terminator item\fR 
  190. .sp 9p
  191. .RT
  192. .PP
  193. Name of item\ \(em\ >
  194. .PP
  195. This item shall consist of the single character\ >.
  196. .PP
  197. \fINote\fR \ \(em\ The item < for the start of definitions is defined in
  198. \(sc\ 8.13.
  199. .RT
  200. .sp 1P
  201. .LP
  202. A.2.7
  203.     \fISyntactic terminal item\fR 
  204. .sp 9p
  205. .RT
  206. .PP
  207. Name of item\ \(em\ astring
  208. .PP
  209. An \*Qastring\*U shall consist of an arbitrary number (possibly zero) of 
  210. characters from the ASN.1 character set (see \(sc\ 7), surrounded by\ \*U. 
  211. The 
  212. character\ \*U shall be represented in an \*Qastring\*U by a pair of\ \*U.
  213. .PP
  214. \fINote\fR \ \(em\ Use of \*Qastring\*U in the macronotation specifies the
  215. occurrence, at the corresponding point in the syntax being analysed, of the
  216. characters enclosed in quotation marks\ (\*U).
  217. .bp
  218. .RT
  219. .ce
  220. \fBH.T. [T8.208]\fR 
  221. .ce
  222. TABLE\ 8/X.208
  223. .ce
  224. \fBSequence specified by items\fR 
  225. .ps 9
  226. .vs 11
  227. .nr VS 11
  228. .nr PS 9
  229. .TS
  230. center box;
  231. cw(48p) | cw(72p) .
  232. Item name    Defining clause
  233. _
  234. .T&
  235. lw(48p) | lw(72p) .
  236. \*Qstring\*U    any sequence of characters
  237. .T&
  238. lw(48p) | lw(72p) .
  239. \*Qidentifier\*U    8.3\ \(em\ Identifiers
  240. .T&
  241. lw(48p) | lw(72p) .
  242. \*Qnumber\*U    8.8\ \(em\ Numbers
  243. .T&
  244. lw(48p) | lw(72p) .
  245. \*Qempty\*U    8.7\ \(em\ Empty  
  246. _
  247. .TE
  248. .nr PS 9
  249. .RT
  250. .ad r
  251. \fBTable 8/X.208 [T8.208], p.\fR 
  252. .sp 1P
  253. .RT
  254. .ad b
  255. .RT
  256. .sp 1P
  257. .LP
  258. .sp 2
  259. A.2.8
  260.     \fISyntactic category keywork items\fR 
  261. .sp 9p
  262. .RT
  263. .LP
  264. .sp 1
  265.     Names of items:
  266.     \*Qstring\*U
  267. .LP
  268. \*Qidentifier\*U
  269. .LP
  270. \*Qnumber\*U
  271. .LP
  272. \*Qempty\*U
  273. .PP
  274. .sp 1
  275. Items with the above names shall consist (in the macronotation) of the 
  276. sequences of characters in the name, excluding the quotation symbols\ (\*U). 
  277. These items are used in the macro notation to specify the occurrence, in 
  278. an 
  279. instance of the new notation, of certain sequences of characters. The sequences 
  280. in the new notation specified by each item are given in Table\ 8/X.208 
  281. by 
  282. reference to a clause in this Recommendation which defines the sequence of
  283. characters appearing in the new notation.
  284. .PP
  285. \fINote\fR \ \(em\ The macro notation does not support the distinction 
  286. between identifiers and references based on the case of the initial letter. 
  287. This is for historical reasons. 
  288. .RT
  289. .sp 1P
  290. .LP
  291. A.2.9
  292.     \fIAdditional keyword items\fR 
  293. .sp 9p
  294. .RT
  295. .LP
  296. .sp 1
  297.     Names of items:
  298.     MACRO
  299. .LP
  300. TYPE
  301. .LP
  302. NOTATION
  303. .LP
  304. VALUE
  305. .LP
  306. value
  307. .LP
  308. type
  309. .PP
  310. .sp 1
  311. Items with the above names shall consist of the sequence of
  312. characters in the name.
  313. .PP
  314. The items specified in clauses \(sc\ A.2.2 to \(sc\ A.2.4 inclusive shall 
  315. not be one of the \(sc\ A.2.9 sequences, except when used as specified 
  316. below. 
  317. .PP
  318. The keyword \*QMACRO\*U shall be used to introduce a macro definition. 
  319. The keyword \*QTYPE 
  320. NOTATION\*U shall be used as the name of the production which
  321. defines the new type notation. The keyword \*QVALUE NOTATION\*U shall be 
  322. used as 
  323. the name of the production which defines the new value notation. The   
  324. .PP
  325. keyword \*QVALUE\*U shall be used as the \*Qlocalvaluereference\*U to which the
  326. resulting value is assigned. The keyword \*Qvalue\*U shall be used to specify 
  327. that each instance of the new notation contains at this point, using standard 
  328. ASN.1 notation, some value of a type (specified in the macro definition). 
  329. The keyword \*Qtype\*U shall be used to specify that each instance of the 
  330. new notation contains at this point, using standard ASN.1 notation, some 
  331. \*QType\*U. 
  332. .bp
  333. .RT
  334. .sp 2P
  335. .LP
  336. A.3
  337.     \fIMacro definition notation\fR 
  338. .sp 1P
  339. .RT
  340. .PP
  341. A.3.1 
  342. A macro shall be defined using the notation \*QMacroDefinition\*U:
  343. .sp 9p
  344. .RT
  345. .LP
  346.     MacroDefinition\ ::=
  347. .LP
  348.     macroreference
  349. .LP
  350. MACRO
  351. .LP
  352. \*Q::=\*U
  353. .LP
  354. MacroSubstance
  355. .LP
  356.     MacroSubstance\ ::=
  357. .LP
  358.     BEGIN MacroBody END\ |
  359. .LP
  360. macroreference\ |
  361. .LP
  362. Externalmacroreference
  363. .LP
  364.     MacroBody\ ::=
  365. .LP
  366.     TypeProduction
  367. .LP
  368. ValueProduction
  369. .LP
  370. SupportingProductions
  371. .LP
  372.     TypeProduction\ ::=
  373. .LP
  374.     TYPE NOTATION
  375. .LP
  376. \*Q::=\*U
  377. .LP
  378. MacroAlternativeList
  379. .LP
  380.     ValueProduction\ ::=
  381. .LP
  382.     VALUE NOTATION
  383. .LP
  384. \*Q::=\*U
  385. .LP
  386. MacroAlternativeList
  387. .LP
  388.     SupportingProduction\ ::=
  389. .LP
  390.     ProductionList\ |
  391. .LP
  392. empty
  393. .LP
  394.     ProductionList\ ::=
  395. .LP
  396.     Production\ |
  397. .LP
  398. ProductionList Production
  399. .LP
  400.     Production\ ::=
  401. .LP
  402.     productionreference
  403. .LP
  404. \*Q::=\*U
  405. .LP
  406. MacroAlternativeList
  407. .LP
  408.     Externalmacroreference\ ::=
  409. .LP
  410.     modulereference\|.\|macroreference
  411. .PP
  412. \fINote\fR \ \(em\ It is intended that one macro definition be permitted 
  413. to reference (i.e.,\ use) other macros. Ensuring that the notation permits 
  414. this is for further study. 
  415. .PP
  416. A.3.2 
  417. If the \*Qmacroreference\*U alternative of \*QMacroSubstance\*U is chosen, 
  418. then the module containing the macro definition shall either: 
  419. .sp 9p
  420. .RT
  421. .LP
  422.     a)
  423.     contain another macro definition defining that
  424. \*Qmacroreference\*U; or
  425. .LP
  426.     b)
  427.     contain the \*Qmacroreference\*U in its \*QSymbolsImported\*U.
  428. .PP
  429. A.3.3 
  430. If the \*QExternalmacroreference\*U alternative of \*QMacroSubstance\*U 
  431. is chosen, then the module denoted by \*Qmodulereference\*U shall contain 
  432. a macro 
  433. definition defining the \*Qmacroreference\*U. The associated definition is then
  434. also associated with the \*Qmacroreference\*U being defined.
  435. .bp
  436. .sp 9p
  437. .RT
  438. .PP
  439. A.3.4
  440. The chain of definitions which can arise from repeated
  441. applications of the rules of \(sc\ A.3.2 to \(sc\ A.3.3 shall terminate with a
  442. \*QMacroDefinition\*U which uses the \*QBEGIN MacroBody END\*U alternative 
  443. and it is 
  444. that \*QMacroBody\*U which defines the type and value notation for the 
  445. macro being defined. 
  446. .PP
  447. A.3.5
  448. Each \*Qproductionreference\*U which occurs in a \*QSymbolDefn\*U (see
  449. \(sc\ A.3.9) shall occur exactly once as the first item in a \*QProduction\*U.
  450. .PP
  451. A.3.6
  452. Each instance of the new type notation shall commence with the
  453. sequence of characters in the \*Qmacroreference\*U, followed by one of the
  454. sequences of characters referenced by \*QTYPE NOTATION\*U after applying the
  455. productions specified in the macro definition.
  456. .PP
  457. A.3.7
  458. Each instance of the new value notation shall consist of one of
  459. the sequences of characters referenced by \*QVALUE NOTATION\*U after applying 
  460. the productions specified in the macro definition. 
  461. .PP
  462. A.3.8
  463. The \*QMacroAlternativeList\*U in a production specifies the possible sets 
  464. of character sequences referenced by the production. It is specified by: 
  465. .LP
  466.     MacroAlternative List\ ::=
  467. .LP
  468.     MacroAlternative\ |
  469. .LP
  470. MacroAlternativeList\ \*Q\ |\ \*U MacroAlternative
  471. .PP
  472. The set of character sequences referenced by the
  473. \*QMacroAlternativeList\*U consists of all the character sequences which are
  474. referenced by any of the \*QMacroAlternative\*U productions in the
  475. \*QMacroAlternativeList\*U.
  476. .PP
  477. A.3.9 
  478. The notation for a \*QMacroAlternative\*U shall be:
  479. .sp 9p
  480. .RT
  481. .LP
  482.     MacroAlternative\ ::=\ SymbolList
  483. .LP
  484.     SymbolList\ ::=
  485. .LP
  486.     SymbolElement
  487. |
  488. .LP
  489. SymbolList SymbolElement
  490. .LP
  491.     SymbolElement\ ::=
  492. .LP
  493.     SymbolDefn
  494. |
  495. .LP
  496. EmbeddedDefinitions
  497. .LP
  498.     SymbolDefn\ ::=
  499. .LP
  500.     astring
  501. |
  502. .LP
  503. productionreference
  504. |
  505. .LP
  506. \*Qstring\*U
  507. |
  508. .LP
  509. \*Qidentifier\*U
  510. |
  511. .LP
  512. \*Qnumber\*U
  513. |
  514. .LP
  515. \*Qempty\*U
  516. |
  517. .LP
  518. type
  519. |
  520. .LP
  521. type(localtypereference)
  522. |
  523. .LP
  524. value(MacroType)
  525. |
  526. .LP
  527. value(localvaluereference MacroType)
  528. |
  529. .LP
  530. value(VALUE MacroType)
  531. .LP
  532.     MacroType\ ::=\ localtypereference
  533. |
  534. .LP
  535.     Type
  536. .PP
  537. \fINote\fR \ \(em\ When in a macro, any \*QMacroType\*U defined in that macro
  538. can appear at any point in which ASN.1 specifies a \*QType\*U.
  539. .PP
  540. A \*QMacroAlternative\*U references all characters strings which are
  541. formed by taking any of the character strings referenced by the first
  542. \*QSymbolDefn\*U in the \*QSymbolList\*U, followed by any one of the character 
  543. strings referenced by the second \*QSymbolDefn\*U in the \*QSymbolList\*U, 
  544. and so on, up to and including the last \*QSymbolDefn\*U in the \*QSymbolList\*U. 
  545. .PP
  546. \fINote\fR \ \(em\ The \*QEmbeddedDefinitions\*U (if any) play no direct 
  547. part in 
  548. determining these strings.
  549. .bp
  550. .RT
  551. .PP
  552. A.3.10 
  553. An \*Qastring\*U references the sequence of characters in the
  554. \*Qastring\*U without the enclosing pair of\ \*U.
  555. .sp 9p
  556. .RT
  557. .PP
  558. A.3.11
  559. A \*Qproductionreference\*U references any sequence of characters
  560. specified by the \*QProduction\*U it identifies.
  561. .PP
  562. A.3.12
  563. The sequences of characters referenced by the next four
  564. alternatives for \*QSymbolDefn\*U are specified in Table\ 8/X.208.
  565. .PP
  566. \fINote\fR \ \(em\ The sequences of characters referenced by the \*Qstring\*U
  567. should be terminated in an instance of the macro notation by the appearance 
  568. of a sequence referenced by the next \*QSymbolDefn\*U in the \*QSymbolList\*U. 
  569. .PP
  570. A.3.13 
  571. A \*Qtype\*U references any sequence of symbols which forms a \*QType\*U 
  572. notation as specified in \(sc\ 12.1. 
  573. .sp 9p
  574. .RT
  575. .PP
  576. \fINote\fR \ \(em\ The \*QDefinedType\*U of \(sc\ 12.1 may in this case 
  577. contain a 
  578. \*Qlocaltypereference\*U referencing a type defined in the macro notation.
  579. .PP
  580. A.3.14
  581. A \*Qtype(localtypereference)\*U references any sequence of symbols which 
  582. forms a \*QType\*U as specified in \(sc\ 12.1, but in addition assigns 
  583. that type to the \*Qlocaltypereference\*U. A later assignment may occur 
  584. to the same 
  585. \*Qlocaltypereference\*U.
  586. .sp 9p
  587. .RT
  588. .PP
  589. A.3.15
  590. A \*Qvalue(MacroType)\*U references any sequence of symbols which
  591. forms a \*QValue\*U notation (as specified in \(sc\ 12.7) for the type 
  592. specified by the \*QMacro Type\*U. 
  593. .PP
  594. A.3.16
  595. A \*Qvalue(localvaluereference MacroType)\*U references any sequence of 
  596. symbols which forms a \*QValue\*U notation (as specified in \(sc\ 12.7) 
  597. for the type specified by \*QMacroType\*U, but in addition assigns the 
  598. value specified by the 
  599. value notation to the \*Qlocalvaluereference\*U. A later assignment may 
  600. occur to 
  601. the \*Qlocalvaluereference\*U.
  602. .PP
  603. A.3.17
  604. A \*Qvalue(VALUE MacroType)\*U references any sequence of symbols
  605. which forms a \*QValue\*U notation (as specified in \(sc\ 12.7) for the 
  606. type specified by \*QMacroType\*U, but in addition returns the value as 
  607. the value specified by the value notation. The type of the value returned 
  608. is the type referenced by 
  609. MacroType.
  610. .PP
  611. A.3.18
  612. Precisely one assignment to VALUE (as specified in \(sc\ A.3.17 or in \(sc\ 
  613. A.3.19) occurs in the analysis of any correct instance of the new value 
  614. notation.
  615. .PP
  616. A.3.19
  617. The notation for an \*QEmbeddedDefinitions\*U shall be:
  618. .LP
  619.     EmbeddedDefinitions\ ::=
  620. .LP
  621.     <EmbeddedDefinitionList>
  622. .LP
  623.     EmbeddedDefinitionList\ ::=
  624. .LP
  625.     EmbeddedDefinition\ |
  626. .LP
  627. EmbeddedDefinitionList
  628. .LP
  629. EmbeddedDefinition
  630. .LP
  631.     EmbeddedDefinition\ ::=
  632. .LP
  633.     LocalTypeassignment\ |
  634. .LP
  635. LocalValueassignment
  636. .LP
  637.     LocalTypeassignment\ ::=
  638. .LP
  639.     localtypereference
  640. .LP
  641. \*Q::=\*U
  642. .LP
  643. MacroType
  644. .LP
  645.     LocalValueassignment\ ::=
  646. .LP
  647.     localvaluereference
  648. .LP
  649. MacroType
  650. .LP
  651. \*Q::=\*U
  652. .LP
  653. MacroValue
  654. .LP
  655.     MacroValue\ ::=
  656. .LP
  657.     Value\ |
  658. .LP
  659. localvaluereference
  660. .bp
  661. .PP
  662. The assignment of a \*QMacroType\*U to a \*Qlocaltypereference\*U (or of 
  663. a \*QMacroValue\*U to a \*Qlocalvaluereference\*U) within an \*QEmbeddedDefinitions\*U 
  664. takes effect during the syntax analysis of an instance of the new notation 
  665. at the 
  666. time when the \*QEmbeddedDefinitions\*U is encountered, and persists until
  667. redefinition of the \*Qlocaltypereference\*U or \*Qlocalvaluereference\*U 
  668. occurs. 
  669. .PP
  670. \fINote\ 1\fR \ \(em\ The use of the associated \*Qlocaltypereference\*U or
  671. \*Qlocalvaluereference\*U elsewhere in the \*QAlternative\*U implies assumptions 
  672. on the nature of the parsing algorithm. Such assumptions should be indicated 
  673. by 
  674. comment. For example, use of the \*Qlocaltypereference\*U textually following 
  675. the \*QEmbeddedDefinitions\*U implies a left to right parse. 
  676. .PP
  677. \fINote\ 2\fR \ \(em\ The \*Qlocalvaluereference\*U \*QVALUE\*U may be 
  678. assigned a value either by the \*Qvalue (VALUE MacroType)\*U construct 
  679. or by an 
  680. \*QEmbeddedDefinition\*U. In both cases, the value is returned, as specified 
  681. in 
  682. \(sc\ A.3.17.
  683. .RT
  684. .sp 1P
  685. .LP
  686. A.4
  687.     \fIUse of the new notation\fR 
  688. .sp 9p
  689. .RT
  690. .PP
  691. Whenever a \*QType\*U (or \*QValue\*U) notation is called for by this
  692. Recommendation, an instance of the type notation (or value notation) defined 
  693. by a macro may be used, provided that the macro is either: 
  694. .RT
  695. .LP
  696.     a)
  697.     defined within the same module; or
  698. .LP
  699.     b)
  700.     imported into the module, by means of the appearance of the
  701. \*Qmacroreference\*U in the \*QSymbolsImported\*U of the module.
  702. .PP
  703. To allow the latter possibility, a \*Qmacroreference\*U can appear as a 
  704. \*QSymbol\*U in \(sc\ 9.1. 
  705. .PP
  706. \fINote\ 1\fR \ \(em\ This extension to the standard ASN.1 notation is 
  707. not shown in the body of this Recommendation. 
  708. .PP
  709. \fINote\ 2\fR \ \(em\ It is possible to construct modules including sequences 
  710. of type assignment and macro definitions which make parsing of the value 
  711. syntax in DEFAULT values arbitrarily complex. 
  712. \v'1P'
  713. .RT
  714. .ce 1000
  715. ANNEX\ B
  716. .ce 0
  717. .ce 1000
  718. (to Recommendation X.208)
  719. .sp 9p
  720. .RT
  721. .ce 0
  722. .ce 1000
  723. \fBISO assignment of OBJECT IDENTIFIER component values\fR 
  724. .sp 1P
  725. .RT
  726. .ce 0
  727. .PP
  728. B.1
  729. Three arcs are specified from the root node. The assignment of
  730. values and identifiers, and the authority for assignment of subsequent
  731. component values, are as follows:
  732. .sp 1P
  733. .RT
  734. .LP
  735.     \fBValue\fR 
  736.     \fBIdentifier\fR     \fBAuthority for subsequent\fR \fBassignments\fR 
  737. .LP
  738.     0
  739.     ccitt
  740.     CCITT
  741. .LP
  742.     1
  743.     iso
  744.     ISO
  745. .LP
  746.     2
  747.     joint\(hyiso\(hyccitt
  748.     See Annex D
  749. .PP
  750. \fINote\fR \ \(em\ The remainder of this annex concerns itself only with 
  751. ISO assignment of values. 
  752. .PP
  753. B.2
  754. The identifiers \*Qccitt\*U, \*Qiso\*U and \*Qjoint\(hyiso\(hyccitt\*U, 
  755. assigned 
  756. above, may each be used as a \*UNameForm\*U.
  757. .sp 9p
  758. .RT
  759. .PP
  760. B.3
  761. Four arcs are specified from the node identified by \*Qiso\*U. The
  762. assignment of values and identifiers is
  763. .LP
  764.     \fBValue\fR 
  765.     \fBIdentifier\fR 
  766.     \fBAuthority for subsequent\fR \fBassignments\fR 
  767. .LP
  768.     0
  769.     standard
  770.     See \(sc B.4
  771. .LP
  772.     1
  773.     registration\(hyauthority 
  774.     See \(sc B.5
  775. .LP
  776.     2
  777.     member\(hybody
  778.     See \(sc B.6
  779. .LP
  780.     3
  781.     identified\(hyorganization
  782.     See \(sc B.7
  783. .PP
  784. These identifiers may be used as a \*QNameForm\*U.
  785. .bp
  786. .PP
  787. B.4
  788. The arcs below \*Qstandard\*U shall each have the value of the number of 
  789. an International Standard. Where the International Standard is multi\(hypart, 
  790. there shall be an additional arc for the part number, unless this is 
  791. specifically excluded in the text of the International Standard. Further 
  792. arcs shall have values as defined in that International Standard. 
  793. .sp 9p
  794. .RT
  795. .PP
  796. \fINote\fR \ \(em\ If a non\(hymultipart International Standard allocates
  797. object identifiers, and subsequently becomes a multipart International
  798. Standard, it shall continue to allocate object identifiers as if it were a
  799. single part International Standard.
  800. .PP
  801. B.5
  802. The arcs below \*Qregistration authority\*U are reserved for an
  803. addendum to this Recommendation which will be progressed alongide the
  804. establishment of procedures for the identification of specific OSI Registration 
  805. Authorities. 
  806. .sp 9p
  807. .RT
  808. .PP
  809. B.6
  810. The arcs immediately below \*Qmember\(hybody\*U shall have values of
  811. three digit numeric country code, as specified in ISO\ 3166, that identifies 
  812. the ISO Member Body in that country (see Note). The \*QNameForm\*U of object 
  813. identifier component is not permitted with these identifiers. Arcs below 
  814. the \*Qcountry 
  815. code\*U are not defined in this Recommendation.
  816. .PP
  817. \fINote\fR \ \(em\ The existence of a country code in ISO 3166 does not
  818. necessarily imply that there is an ISO Member Body representing that country
  819. or that the ISO Member Body for that country administers a scheme for the
  820. allocation of object identifier components.
  821. .PP
  822. B.7
  823. The arcs immediately below \*Qidentified\(hyorganization\*U shall have
  824. values of an International Code Designator (ICD) allocated by the Registration 
  825. Authority for ISO\ 6523 that identify an issuing organization specifically 
  826. registered by the authority as allocating object identifier components (see
  827. Notes\ 1 and\ 2). The arcs immediately below the ICD shall have values of an
  828. \*Qorganization code\*U allocated by the issuing organization in accordance 
  829. with 
  830. ISO\ 6523. Arcs below \*Qorganization code\*U are not defined by this Recommendation 
  831. (see Note\ 3). 
  832. .sp 9p
  833. .RT
  834. .PP
  835. \fINote\ 1\fR \ \(em\ The requirement that issuing organizations are recorded 
  836. by the Registration Authority for ISO\ 6523 as allocating organization 
  837. codes for the purpose of object identifier components ensures that only 
  838. numerical values in accordance with this Recommendation are allocated. 
  839. .PP
  840. \fINote\ 2\fR \ \(em\ The declaration that an issuing organization allocates
  841. organization codes for the purpose of object identifier components does not
  842. preclude the use of these codes for other purposes.
  843. .PP
  844. \fINote\ 3\fR \ \(em\ It is assumed that the organizations identified by the
  845. \*Qorganization code\*U will define further arcs in such a way as to ensure
  846. allocation of unique values.
  847. .PP
  848. \fINote\ 4\fR \ \(em\ The effect of B.7 is that any organization can obtain an
  849. organization code from an appropriate issuing organization, and can then 
  850. assign OBJECT IDENTIFIER values for its own purposes, with the assurance 
  851. that those 
  852. values will not conflict with values assigned by other organizations. By 
  853. this means, a manufacturer could, for example, assign an OBJECT IDENTIFIER 
  854. to its 
  855. own proprietary information formats.
  856. \v'1P'
  857. .RT
  858. .ce 1000
  859. ANNEX\ C
  860. .ce 0
  861. .ce 1000
  862. (to Recommendation X.208)
  863. .sp 9p
  864. .RT
  865. .ce 0
  866. .ce 1000
  867. \fBCCITT assignment of OBJECT IDENTIFIER component values\fR 
  868. .sp 1P
  869. .RT
  870. .ce 0
  871. .PP
  872. C.1
  873. Three arcs are specified from the root node. The assignment of
  874. values and identifiers, and the authority for assignment of subsequent
  875. component values, are as follows:
  876. .sp 1P
  877. .RT
  878. .LP
  879.     \fBValue\fR 
  880.     \fBIdentifier\fR     \fBAuthority for subsequent\fR \fBassignments\fR 
  881. .LP
  882.     0
  883.     ccitt
  884.     CCITT
  885. .LP
  886.     1
  887.     iso
  888.     ISO
  889. .LP
  890.     2
  891.     joint\(hyiso\(hyccitt
  892.     See Annex D
  893. .PP
  894. \fINote\fR \ \(em\ The remainder of this annex concerns itself only with
  895. CCITT assignment of values.
  896. .PP
  897. C.2
  898. The identifiers \*Qccitt\*U, \*Qiso\*U and \*Qjoint\(hyiso\(hyccitt\*U, 
  899. assigned 
  900. above, may each be used as a \*UNameForm\*U.
  901. .bp
  902. .sp 9p
  903. .RT
  904. .PP
  905. C.3
  906. Four arcs are specified from the node identified by \*Qccitt\*U. The assignment 
  907. of values and identifiers is 
  908. .LP
  909.     \fBValue\fR 
  910.     \fBIdentifier\fR     \fBAuthority for subsequent\fR \fBassignments\fR 
  911. .LP
  912.     0
  913.     recommendation
  914.     See \(sc C.4
  915. .LP
  916.     1
  917.     question
  918.     See \(sc C.5
  919. .LP
  920.     2
  921.     administration
  922.     See \(sc C.6
  923. .LP
  924.     3
  925.     network\(hyoperator
  926.     See \(sc C.7
  927. .PP
  928. These identifiers may be used as a \*QNameForm\*U.
  929. .PP
  930. C.4
  931. The arcs below \*Qrecommendation\*U have the value 1 to 26 with
  932. assigned identifiers of a to z. Arcs below these have the numbers of CCITT
  933. Recommendations in the series identified by the letter. Arcs below this are
  934. determined as necessary by the CCITT Recommendation. The identifiers\ a 
  935. to\ z may be used as a \*QNameForm\*U. 
  936. .sp 9p
  937. .RT
  938. .PP
  939. C.5
  940. The arcs below \*Qquestion\*U have values corresponding to CCITT Study 
  941. Groups, qualified by the Study Period. The value is computed by the 
  942. formula:
  943. .sp 1P
  944. .ce 1000
  945. study group number + (Period * 32)
  946. .ce 0
  947. .sp 1P
  948. .LP
  949. where \*QPeriod\*U has the value 0 for 1984\(hy1988, 1 for
  950. 1988\(hy1992,\ etc., and the multiplier is 32 decimal.
  951. .PP
  952. The arcs below each study group have the values corresponding to the questions 
  953. assigned to that study group. Arcs below this are determined as 
  954. necessary by the group (e.g. working party or special rapporteur group)
  955. assigned to study the question.
  956. .PP
  957. C.6
  958. The arcs below administration have the values of X.121 DCCs.
  959. Arcs below this are determined as necessary by the Administration of the
  960. country identified by the X.121\ DCC.
  961. .sp 9p
  962. .RT
  963. .PP
  964. C.7
  965. The arcs below \*Qnetwork\(hyoperator\*U have the value of X.121 DNICs. 
  966. Arcs below this are determined as necessary by the Administration or RPOA 
  967. identified by the DNIC.
  968. .ce 1000
  969. ANNEX\ D
  970. .ce 0
  971. .ce 1000
  972. (to Recommendation X.208)
  973. .sp 9p
  974. .RT
  975. .ce 0
  976. .ce 1000
  977. \fBJoint assignment of OBJECT IDENTIFIER component values\fR 
  978. .sp 1P
  979. .RT
  980. .ce 0
  981. .PP
  982. D.1
  983. Three arcs are specified from the root node. The assignment of
  984. values and identifiers, and the authority for assignment of subsequent
  985. component values, are as follows:
  986. .sp 1P
  987. .RT
  988. .LP
  989.     \fBValue\fR 
  990.     \fBIdentifier\fR     \fBAuthority for subsequent\fR \fBassignments\fR 
  991. .LP
  992.     0
  993.     ccitt
  994.     CCITT
  995. .LP
  996.     1
  997.     iso
  998.     ISO
  999. .LP
  1000.     2
  1001.     joint\(hyiso\(hyccitt
  1002.     See below
  1003. .PP
  1004. \fINote\fR \ \(em\ The remainder of this annex concerns itself only with
  1005. ISO\(hyCCITT assignment of values.
  1006. .PP
  1007. D.2
  1008. The identifiers \*Qccitt\*U, \*Qiso\*U and \*Qjoint\(hyiso\(hyccitt\*U, 
  1009. assigned 
  1010. above, may each be used as a \*QNameForm\*U.
  1011. .sp 9p
  1012. .RT
  1013. .PP
  1014. D.3
  1015. The arcs below \*Qjoint\(hyiso\(hyccitt\*U have values which are assigned
  1016. and agreed from time to time by ISO and CCITT to identify areas of joint
  1017. ISO\(hyCCITT standardisation activity, in accordance with the \*QProcedures for
  1018. assignment of object identifier component values for joint ISO\(hyCCITT
  1019. use\*U
  1020. .FS
  1021. The Registration Authority for assignment of object identifier
  1022. component values for joint ISO\(hyCCITT use is the American National Standards
  1023. Institute (ANSI), 1430\ Broadway, New\ York, NY\ 10018,\ USA.
  1024. .FE
  1025. .
  1026. .PP
  1027. D.4
  1028. The arcs beneath each arc identified by the mechanisms of \(sc\ D.3
  1029. shall be allocated in accordance with mechanisms established when the arc is
  1030. allocated.
  1031. .PP
  1032. \fINote\fR \ \(em\ It is expected that this will involve delegation of
  1033. authority to the joint agreement of CCITT and ISO Rapporteurs for the joint
  1034. area of work.
  1035. .PP
  1036. D.5
  1037. Initial ISO Standards and CCITT Recommendations in areas of joint ISO\(hyCCITT 
  1038. activity require to allocate OBJECT IDENTIFIERS in advance of the 
  1039. establishment of the procedures of\ D.3, and hence allocate in accordance 
  1040. with annexes\ B or\ C. Information objects identified in this way by ISO 
  1041. Standards or CCITT Recommendations shall not have their OBJECT IDENTIFIERS 
  1042. changed when the procedures of D.3 are established. 
  1043. \v'1P'
  1044. .bp
  1045. .sp 9p
  1046. .RT
  1047. .ce 1000
  1048. APPENDIX\ I
  1049. .ce 0
  1050. .ce 1000
  1051. (to Recommendation X.208)
  1052. .sp 9p
  1053. .RT
  1054. .ce 0
  1055. .ce 1000
  1056. \fBExemples and hints\fR 
  1057. .sp 1P
  1058. .RT
  1059. .ce 0
  1060. .PP
  1061. This appendix contains examples of the use of ASN.1 in the
  1062. description of (hypothetical) data structures. It also contains hints, or
  1063. guidelines, for the use of the various features of ASN.1.
  1064. .sp 1P
  1065. .RT
  1066. .sp 1P
  1067. .LP
  1068. I.1
  1069.     \fIExample of a personnel record\fR 
  1070. .sp 9p
  1071. .RT
  1072. .PP
  1073. The use of ASN.1 is illustrated by means of a simple, hypothetical personnel 
  1074. record. 
  1075. .RT
  1076. .sp 1P
  1077. .LP
  1078. I.1.1
  1079.     \fIInformal description of personnel record\fR 
  1080. .sp 9p
  1081. .RT
  1082. .PP
  1083. The structure of the personnel record and its value for a
  1084. particular individual are shown below.
  1085. .RT
  1086. .LP
  1087.     Name:
  1088.     John P Smith
  1089. .LP
  1090.     Title:
  1091.     Director
  1092. .LP
  1093.     Employee Number:
  1094.     51
  1095. .LP
  1096.     Date of Hire:
  1097.     17 September 1971
  1098. .LP
  1099.     Name of Spouse:
  1100.     Mary T Smith
  1101. .LP
  1102.     Number of Children:
  1103.     2
  1104. .LP
  1105.     Child Information
  1106. .LP
  1107.     Name:
  1108.     Ralph T Smith
  1109. .LP
  1110.     Date of Birth
  1111.     11 November 1957
  1112. .LP
  1113.     Child Information
  1114. .LP
  1115.     Name:
  1116.     Susan B Jones
  1117. .LP
  1118.     Date of Birth
  1119.     17 July 1959
  1120. .sp 1P
  1121. .LP
  1122. I.1.2
  1123.     \fIASN.1 description of the record structure\fR 
  1124. .sp 9p
  1125. .RT
  1126. .PP
  1127. The structure of every personnel record is formally described below using 
  1128. the standard notation for data types. 
  1129. .RT
  1130. .LP
  1131.     PersonnelRecord ::= [APPLICATION 0] IMPLICIT SET
  1132. .LP
  1133. {
  1134.     Name,
  1135. .LP
  1136.     \ title
  1137.     [0] VisibleString,
  1138. .LP
  1139.     \ number
  1140.     EmployeeNumber,
  1141. .LP
  1142.     \ dateOfHire
  1143.     [1] Date,
  1144. .LP
  1145.     \ nameOfSpouse
  1146.     [2] Name,
  1147. .LP
  1148.     \ children
  1149.     [3] IMPLICIT
  1150. .LP
  1151. SEQUENCE OF
  1152. .LP
  1153. ChildInformation
  1154. .LP
  1155. DEFAULT\ {\|}\ }
  1156. .LP
  1157.     ChildInformation ::= SET
  1158. .LP
  1159. \ \ {
  1160.     Name,
  1161. .LP
  1162.     \ \ \ dateOfBirth
  1163.     [0] Date}
  1164. .LP
  1165.     Name ::= [APPLICATION 1] IMPLICIT SEQUENCE
  1166. .LP
  1167. {givenName
  1168.     VisibleString,
  1169. .LP
  1170.     \ initial
  1171.     VisibleString,
  1172. .LP
  1173.     \ familyName
  1174.     VisibleString}
  1175. .LP
  1176.     EmployeeNumber ::= [APPLICATION 2] IMPLICIT INTEGER
  1177. .LP
  1178.     Date ::= [APPLICATION 3] IMPLICIT VisibleString\(hy\(hy\ YYYYMMDD
  1179. .bp
  1180. .PP
  1181. This example illustrates an aspect of the parsing of the ASN.1
  1182. syntax. The sintactic construct \*QDEFAULT\*U can only be applied to an 
  1183. element of a \*QSEQUENCE\*U or a \*QSET\*U, it cannot be applied to an 
  1184. element of a \*QSEQUENCE\ OF\*U. Thus the \*QDEFAULT\ {\|}\*U in \*QPersonnelRecord\*U 
  1185. applies to \*Qchildren\*U, not to 
  1186. \*QChildInformation\*U.
  1187. .sp 1P
  1188. .LP
  1189. I.1.3
  1190.     \fIASN.1 description of a record value\fR 
  1191. .sp 9p
  1192. .RT
  1193. .PP
  1194. The value of John Smith's personnel record is formally described
  1195. below using the standard notation for data values.
  1196. .RT
  1197. .LP
  1198.     {
  1199.     {givenName \*QJohn\*U,initial \*QP\*U,familyName \*QSmith\*U}
  1200. .LP
  1201.     \ title
  1202.     \*QDirector\*U
  1203. .LP
  1204.     \ number
  1205.     51
  1206. .LP
  1207.     \ dataOfHire
  1208.     \*Q19710917\*U
  1209. .LP
  1210.     \ nameOfSpouse 
  1211.     {givenName \*QMary\*U,initial \*QT\*U,familyName \*QSmith\*U}
  1212. .LP
  1213.     \ children
  1214. .LP
  1215. \ \ {{{\ givenName \*QRalph\*U,initial \*QT\*U,familyName \*QSmith\*U}
  1216. .LP
  1217. \ \ \ \ \ dateOfBirth \*Q19571111\*U}
  1218. .LP
  1219. \ \ \ \ \ {{givenName \*USusan\*U,initial \*QB\*U,familyName \*QJones\*U}
  1220. .LP
  1221. \ \ \ \ \ dateOfBirth \*Q19590717\*U}}}
  1222. .sp 1P
  1223. .LP
  1224. I.2
  1225.     \fIGuidelines for use of the notation\fR 
  1226. .sp 9p
  1227. .RT
  1228. .PP
  1229. The data types and formal notation defined by this Recommendation are flexible, 
  1230. allowing a wide range of protocols to be designed using them. 
  1231. This flexibility, however, can sometimes lead to confusion, especially 
  1232. when the notation is approached for the first time. This Annex attempts 
  1233. to minimise 
  1234. confusion by giving guidelines for, and examples of, the use of the notation. 
  1235. For each of the built\(hyin data types, one or more usage guidelines are 
  1236. offered. The character string types (for example, VisibleString) and the 
  1237. types defines in section three are not dealt with here. 
  1238. .RT
  1239. .sp 2P
  1240. .LP
  1241. I.2.1
  1242.     \fIBoolean\fR 
  1243. .sp 1P
  1244. .RT
  1245. .PP
  1246. I.2.1.1
  1247. Use a Boolean type to model the values of a logical (that
  1248. is, two\(hystate) variable, for example, the answer to a yes\(hyor\(hyno 
  1249. question. 
  1250. .sp 9p
  1251. .RT
  1252. .LP
  1253.     \fIExample:\fR 
  1254. .LP
  1255.     Employed ::= BOOLEAN
  1256. .PP
  1257. I.2.1.2 
  1258. When assigning a reference name to a Boolean type, choose one
  1259. that describes the \fBtrue\fR state.
  1260. .sp 9p
  1261. .RT
  1262. .LP
  1263.     \fIExample:\fR 
  1264. .LP
  1265.     Married ::= BOOLEAN
  1266. .LP
  1267.     not
  1268. .LP
  1269.     MaritalStatus ::= BOOLEAN
  1270. .PP
  1271. See also \(sc I.2.3.2
  1272. .sp 2P
  1273. .LP
  1274. I.2.2
  1275.     \fIInteger\fR 
  1276. .sp 1P
  1277. .RT
  1278. .PP
  1279. I.2.2.1
  1280. Use an integer type to model the values (for all practical
  1281. purposes, unlimited in magnitude) of a cardinal or integer variable.
  1282. .sp 9p
  1283. .RT
  1284. .LP
  1285.     \fIExample:\fR 
  1286. .LP
  1287.     CheckingAccountBalance ::= INTEGER
  1288. .LP
  1289. \ \(hy\(hy\ in cents; negative means overdrawn
  1290. .PP
  1291. I.2.2.2
  1292. Define the minimum and maximum allowed values of an integer type as distinguished 
  1293. values. 
  1294. .sp 9p
  1295. .RT
  1296. .LP
  1297.     \fIExample:\fR 
  1298. .LP
  1299.     DayOfTheMonth ::= INTEGER {first(1),last(31)}
  1300. .bp
  1301. .sp 2P
  1302. .LP
  1303. I.2.3
  1304.     \fIEnumerated\fR 
  1305. .sp 1P
  1306. .RT
  1307. .PP
  1308. I.2.3.1 
  1309. Use an enumerated type with distinguished values to model the
  1310. values of a variable with three or more states. Assign values starting with
  1311. zero if their only constraint is distinctness.
  1312. .sp 9p
  1313. .RT
  1314. .LP
  1315.     \fIExample:\fR 
  1316. .LP
  1317.     DayOfTheWeek ::= ENUMERATED
  1318. .LP
  1319. \ {sunday(0),monday(1),tuesday(2),wednesday(3),thursday(4),friday(5),saturday(6)} 
  1320. .PP
  1321. I.2.3.2 
  1322. Use an enumerated type to model the values of a variable that
  1323. has just two states now but that may have additional states in a future 
  1324. version of the protocol. 
  1325. .sp 9p
  1326. .RT
  1327. .LP
  1328.     \fIExample:\fR 
  1329. .LP
  1330.     MaritalStatus ::= ENUMERATED {single(0),married(1)}
  1331. .LP
  1332. in anticipation of
  1333. .LP
  1334.     MaritalStatus ::= ENUMERATED {single(0),married(1),widowed(2)}
  1335. .sp 2P
  1336. .LP
  1337. I.2.4
  1338.     \fIReal\fR 
  1339. .sp 1P
  1340. .RT
  1341. .PP
  1342. I.2.4.1 
  1343. Use a real type to model an approximate number.
  1344. .sp 9p
  1345. .RT
  1346. .LP
  1347.     \fIExample:\fR 
  1348. .LP
  1349.     AngleInRadians ::= REAL
  1350. .LP
  1351. pi REAL ::= {3141592653589793238462643383279, 10, \(em30}
  1352. .sp 2P
  1353. .LP
  1354. I.2.5
  1355.     \fIBit string\fR 
  1356. .sp 1P
  1357. .RT
  1358. .PP
  1359. I.2.5.1 
  1360. Use a bit string type to model binary data whose format and
  1361. length are unspecified, or specified elsewhere, and whose length in bits 
  1362. is not necessarily a multiple of eight. 
  1363. .sp 9p
  1364. .RT
  1365. .LP
  1366.     \fIExample:\fR 
  1367. .LP
  1368.     G3FacsimilePage ::= BIT STRING
  1369. .LP
  1370. \ \(hy\(hy\ a sequence of bits conforming to CCITT
  1371. .LP
  1372. \ \(hy\(hy\ Recommendation T.4.
  1373. .PP
  1374. I.2.5.2 
  1375. Define the first and last meaningful bits of a fixed\(hylength bit string 
  1376. as distinguished bits. 
  1377. .sp 9p
  1378. .RT
  1379. .LP
  1380.     \fIExample:\fR 
  1381. .LP
  1382.     Nibble ::= BIT STRING {first(0),last(3)}
  1383. .PP
  1384. I.2.5.3
  1385. Use a bit string type to model the values of a \fBbit map\fR , an
  1386. ordered collection of logical variables indicating whether a particular
  1387. condition holds for each of a correspondingly ordered collection of objects.
  1388. .sp 9p
  1389. .RT
  1390. .LP
  1391.     \fIExample:\fR 
  1392. .LP
  1393.     SunnyDaysOfTheMonth ::= BIT STRING {first(1),last(31)}
  1394. .LP
  1395. \ \(hy\(hy\ Day i was sunny if and only if bit i is one
  1396. .PP
  1397. I.2.5.4 
  1398. Use a bit string type with distinguished values to model the
  1399. values of a collection of related logical variables.
  1400. .sp 9p
  1401. .RT
  1402. .LP
  1403.     \fIExample:\fR 
  1404. .LP
  1405.     PersonalStatus ::= BIT STRING
  1406. .LP
  1407. \ {married(0),employed(1),veteran(2),collegeGraduate(3)}
  1408. .sp 2P
  1409. .LP
  1410. I.2.6
  1411.     \fIOctet string\fR 
  1412. .sp 1P
  1413. .RT
  1414. .PP
  1415. I.2.6.1 
  1416. Use an octet string type to model binary data whose format and length are 
  1417. unspecified, or specified elsewhere, and whose length in bits is a multiple 
  1418. of eight. 
  1419. .sp 9p
  1420. .RT
  1421. .LP
  1422.     \fIExample:\fR 
  1423. .LP
  1424.     G4FacsimileImage ::= OCTET STRING
  1425. .LP
  1426. \ \(hy\(hy\ a sequence of octets conforming to
  1427. .LP
  1428. \ \(hy\(hy\ CCITT Recommendations T.5 and T.6
  1429. .bp
  1430. .PP
  1431. I.2.6.2 
  1432. Use a character string type in preference to an octet string
  1433. type, where an appropriate one is available.
  1434. .sp 9p
  1435. .RT
  1436. .LP
  1437.     \fIExample:\fR 
  1438. .LP
  1439.     Surname ::= PrintableString
  1440. .PP
  1441. I.2.6.3 
  1442. Use an octet string type to model any string of information
  1443. which cannot be modelled using one of the character string types. Be sure to
  1444. specify the repertoire of characters and their coding into octets.
  1445. .sp 9p
  1446. .RT
  1447. .LP
  1448.     \fIExample:\fR 
  1449. .LP
  1450.     PackedBCDString ::= OCTET STRING
  1451. .LP
  1452. \ \(hy\(hy\ the digits 0 through 9, two digits per octet,
  1453. .LP
  1454. \ \(hy\(hy\ each digit encoded as 0000 to 1001,
  1455. .LP
  1456. \ \(hy\(hy\ 1111\d2\uused for padding.
  1457. .sp 1P
  1458. .LP
  1459. I.2.7
  1460.     \fINull\fR 
  1461. .sp 9p
  1462. .RT
  1463. .PP
  1464. Use a null type to indicate the effective absence of an element of  a sequence.
  1465. .RT
  1466. .LP
  1467.     \fIExample:\fR 
  1468. .LP
  1469.     PatientIdentifier ::= SEQUENCE
  1470. .LP
  1471. \ {name
  1472.     VisibleString,
  1473. .LP
  1474.     \ roomNumber 
  1475.     CHOICE
  1476. .LP
  1477.     \ \ \ \ \ {INTEGER,
  1478. .LP
  1479. \ \ \ \ \ NULL\ \(hy\(hy\ if an out\(hypatient\ \(hy\(hy}}
  1480. .PP
  1481. \fINote\fR \ \(em\ The use of \*QOPTIONAL\*U provides an equivalent facility.
  1482. .sp 2P
  1483. .LP
  1484. I.2.8
  1485.     \fISequence and sequence\(hyof\fR 
  1486. .sp 1P
  1487. .RT
  1488. .PP
  1489. I.2.8.1 
  1490. Use a sequence\(hyof type to model a collection of variables whose types 
  1491. are the same, whose number is large or unpredictable, and whose order is 
  1492. significant. 
  1493. .sp 9p
  1494. .RT
  1495. .LP
  1496.     \fIExample:\fR 
  1497. .LP
  1498.     NamesOfMemberNations ::= SEQUENCE OF VisibleString
  1499. .LP
  1500. \ \(hy\(hy\ in the order in which they joined
  1501. .PP
  1502. I.2.8.2 
  1503. Use a sequence type to model a collection of variables whose
  1504. types are the same, whose number is known and modest, and whose order is
  1505. significant, provided that the makeup of the collection is unlikely to 
  1506. change from one version of the protocol to the next. 
  1507. .sp 9p
  1508. .RT
  1509. .LP
  1510.     \fIExample:\fR 
  1511. .LP
  1512.     NamesOfOfficers ::= SEQUENCE
  1513. .LP
  1514. {president
  1515.     VisibleString,
  1516. .LP
  1517.     \ vicePresident
  1518.     VisibleString,
  1519. .LP
  1520.     \ secretary
  1521.     VisibleString}
  1522. .PP
  1523. I.2.8.3 
  1524. Use a sequence type to model a collection of variables whose
  1525. types differ, whose number is known and modest, and whose order is significant, 
  1526. provided that the makeup of the collection is unlikely to change from one 
  1527. version of the protocol to the next.
  1528. .sp 9p
  1529. .RT
  1530. .LP
  1531.     \fIExample:\fR 
  1532. .LP
  1533.     Credentials ::= SEQUENCE
  1534. .LP
  1535. \ {userName
  1536.     VisibleString,
  1537. .LP
  1538.     \ password
  1539.     VisibleString,
  1540. .LP
  1541.     \ accountNumber
  1542.     INTEGER}
  1543. .bp
  1544. .PP
  1545. I.2.8.4 
  1546. If the elements of a sequence type are fixed in number but of
  1547. several types, a reference name should be assigned to every element whose
  1548. purpose is not fully evident from its type.
  1549. .sp 9p
  1550. .RT
  1551. .LP
  1552.     \fIExample:\fR 
  1553. .LP
  1554.     File ::= SEQUENCE
  1555. .LP
  1556. \ {
  1557.     ContentType,
  1558. .LP
  1559.     \ other
  1560.     FileAttributes,
  1561. .LP
  1562.     \ content
  1563.     ANY}
  1564. .PP
  1565. See also \(sc I.2.5.3, \(sc I.2.5.4, and \(sc I.2.7.
  1566. .sp 2P
  1567. .LP
  1568. I.2.9
  1569.     \fISet\fR 
  1570. .sp 1P
  1571. .RT
  1572. .PP
  1573. I.2.9.1 
  1574. Use a set type to model a collection of variables whose number is known 
  1575. and modest and whose order is insignificant. Identify each variable by 
  1576. context\(hyspecifically tagging it. 
  1577. .sp 9p
  1578. .RT
  1579. .LP
  1580.     \fIExample:\fR 
  1581. .LP
  1582.     UserName ::= SET
  1583. .LP
  1584. \ {personalName
  1585.     [0] IMPLICIT VisibleString,
  1586. .LP
  1587.     \ organisationName
  1588.     [1] IMPLICIT VisibleString,
  1589. .LP
  1590.     \ countryName
  1591.     [2] IMPLICIT VisibleString}
  1592. .PP
  1593. I.2.9.2 
  1594. Use a set type with \*QOPTIONAL\*U to model a collection of
  1595. variables that is a (proper or improper) subset of another collection of
  1596. variables whose number is known and reasonably small and whose order is
  1597. insignificant. Identify each variable by context\(hyspecifically tagging it.
  1598. .sp 9p
  1599. .RT
  1600. .LP
  1601.     \fIExample:\fR 
  1602. .LP
  1603.     UserName ::= SET
  1604. .LP
  1605. \ {personalName
  1606.     [0] IMPLICIT VisibleString,
  1607. .LP
  1608.     \ organisationName
  1609.     [1] IMPLICIT VisibleString OPTIONAL
  1610. .LP
  1611.     \ \ \(hy\(hy\ defaults to that of the local organisation\ \(hy\(hy,
  1612. .LP
  1613.     \ countryName
  1614.     [2] IMPLICIT VisibleString OPTIONAL
  1615. .LP
  1616.     \ \ \(hy\(hy\ defaults to that of the local country\ \(hy\(hy}
  1617. .PP
  1618. I.2.9.3 
  1619. Use a set type to model a collection of variables whose makeup is likely 
  1620. to change from one version of the protocol to the next. Identify each variable 
  1621. by context\(hyspecifically tagging it. 
  1622. .sp 9p
  1623. .RT
  1624. .LP
  1625.     \fIExample:\fR 
  1626. .LP
  1627.     UserName ::= SET
  1628. .LP
  1629. \ {personalName
  1630.     [0] IMPLICIT VisibleString,
  1631. .LP
  1632.     \ organisationName
  1633.     [1] IMPLICIT VisibleString OPTIONAL
  1634. .LP
  1635.     \ \ \(hy\(hy\ defaults to that of the local organisation\ \(hy\(hy,
  1636. .LP
  1637.     \ countryName
  1638.     [2] IMPLICIT VisibleString OPTIONAL
  1639. .LP
  1640.     \ \ \(hy\(hy\ defaults to that of the local country
  1641. .LP
  1642.     \ \ \(hy\(hy\ other optional attributes are for further study\ \(hy\(hy}
  1643. .PP
  1644. I.2.9.4 
  1645. If the members of a set type are fixed in number, a reference
  1646. name should be assigned to every member whose purpose is not fully evident 
  1647. from its type. 
  1648. .sp 9p
  1649. .RT
  1650. .LP
  1651.     \fIExample:\fR 
  1652. .LP
  1653.     FileAttributes ::= SET
  1654. .LP
  1655. \ {owner
  1656.     [0] IMPLICIT UserName,
  1657. .LP
  1658.     \ sizeOfContentInOctets
  1659.     [1] IMPLICIT INTEGER,
  1660. .LP
  1661. [2] IMPLICIT AccessControls,
  1662. .LP
  1663.     \ .\|.\|.}
  1664. .bp
  1665. .PP
  1666. I.2.9.5 
  1667. Use a set type to model a collection of variables whose types
  1668. are the same and whose order is insignificant.
  1669. .sp 9p
  1670. .RT
  1671. .LP
  1672.     \fIExample:\fR 
  1673. .LP
  1674.     Keywords ::= SET OF VisibleString\ \(hy\(hy\ in arbitrary order
  1675. .PP
  1676. See also \(sc I.2.5.4 and \(sc I.2.10.3.
  1677. .sp 2P
  1678. .LP
  1679. I.2.10\ \ \fITagged\fR 
  1680. .sp 1P
  1681. .RT
  1682. .sp 1P
  1683. .LP
  1684. I.2.10.1\ \ Use a universal tagged type to define \(em\ in this Recommendation
  1685. only\ \(em a generally useful, application independent data type that must be
  1686. distinguishable (by means of its representation) from all other data types.
  1687. .sp 9p
  1688. .RT
  1689. .LP
  1690.     \fIExample:\fR 
  1691. .LP
  1692.     EncryptionKey ::= [UNIVERSAL 30] IMPLICIT OCTET STRING
  1693. .LP
  1694. \(hy\(hy\ seven octets
  1695. .sp 1P
  1696. .LP
  1697. I.2.10.2\ \ Use an application\(hywide tagged type to define a data type that
  1698. finds wide, scattered use within a particular presentation context and that
  1699. must be dintinguisable (by means of its representation) from all other data
  1700. types used in the presentation context.
  1701. .sp 9p
  1702. .RT
  1703. .LP
  1704.     \fIExample:\fR 
  1705. .LP
  1706.     FileName ::= [APPLICATION 8] IMPLICIT SEQUENCE
  1707. .LP
  1708. \ {directoryName
  1709.     VisibleString,
  1710. .LP
  1711.     \ directoryRelativeFileName
  1712.     VisibleString}
  1713. .sp 1P
  1714. .LP
  1715. I.2.10.3\ \ Use context\(hyspecific tagged types to distinguish the members 
  1716. of a set. Assign numeric tags starting with zero if their only constraint 
  1717. is 
  1718. distinctness.
  1719. .sp 9p
  1720. .RT
  1721. .LP
  1722.     \fIExample:\fR 
  1723. .LP
  1724.     CustomerRecord ::= SET
  1725. .LP
  1726. \ {name
  1727.     [0] IMPLICIT VisibleString,
  1728. .LP
  1729.     \ mailingAddress
  1730.     [1] IMPLICIT VisibleString,
  1731. .LP
  1732.     \ accountNumber 
  1733.     [2] IMPLICIT INTEGER,
  1734. .LP
  1735.     \ balanceDue
  1736.     [3] IMPLICIT INTEGER\ \(hy\(hy\ in cents\ \(hy\(hy}
  1737. .sp 1P
  1738. .LP
  1739. I.2.10.4\ \ Where a particular set member has been application\(hywide 
  1740. tagged, a further context\(hyspecific tag need not be used, unless it is 
  1741. (or may be in the future) needed for distinctness. Where the set member 
  1742. has been universally 
  1743. tagged, a further context\(hyspecific tag should be used.
  1744. .sp 9p
  1745. .RT
  1746. .LP
  1747.     \fIExample:\fR 
  1748. .LP
  1749.     ProductRecord ::= SET
  1750. .LP
  1751. \ {
  1752.     UniformCode,
  1753. .LP
  1754.     \ description
  1755.     [0] IMPLICIT VisibleString,
  1756. .LP
  1757.     \ inventoryNo
  1758.     [1] IMPLICIT INTEGER,
  1759. .LP
  1760.     \ inventoryLevel
  1761.     [2] IMPLICIT INTEGER}
  1762. .LP
  1763.     UniformCode ::= [APPLICATION 13] IMPLICIT INTEGER
  1764. .bp
  1765. .sp 1P
  1766. .LP
  1767. I.2.10.5\ \ Use context\(hyspecific tagged types to distinguish the
  1768. alternatives of a CHOICE. Assign numeric tags starting with zero if their 
  1769. only constraint is distinctness. 
  1770. .sp 9p
  1771. .RT
  1772. .LP
  1773.     \fIExample:\fR 
  1774. .LP
  1775.     CustomerAttribute ::= CHOICE
  1776. .LP
  1777. \ {name
  1778.     [0] IMPLICIT VisibleString,
  1779. .LP
  1780.     \ mailingAddress
  1781.     [1] IMPLICIT VisibleString,
  1782. .LP
  1783.     \ accountNumber 
  1784.     [2] IMPLICIT INTEGER,
  1785. .LP
  1786.     \ balanceDue
  1787.     [3] IMPLICIT INTEGER\ \(hy\(hy\ in cents\ \(hy\(hy}
  1788. .sp 1P
  1789. .LP
  1790. I.2.10.6\ \ Where a particular CHOICE alternative has been defined using an
  1791. application\(hywide tagged type, a further context\(hyspecific tag need 
  1792. not be used, unless it is (or maybe in the future) needed for distinctness. 
  1793. .sp 9p
  1794. .RT
  1795. .LP
  1796.     \fIExample:\fR 
  1797. .LP
  1798.     ProductDesignator ::= CHOICE
  1799. .LP
  1800. \ {
  1801.     UniformCode,
  1802. .LP
  1803.     \ description
  1804.     [0] IMPLICIT VisibleString,
  1805. .LP
  1806.     \ inventoryNo
  1807.     [1] IMPLICIT INTEGER}
  1808. .LP
  1809.     UniformCode ::= [APPLICATION 13] IMPLICIT INTEGER
  1810. .sp 1P
  1811. .LP
  1812. I.2.10.7\ \ Where a particular CHOICE alternative has been universally
  1813. tagged, a further context\(hyspecific tag should be used, unless the provision 
  1814. of more than one universal type is the purpose of the choice. 
  1815. .sp 9p
  1816. .RT
  1817. .LP
  1818.     \fIExample:\fR 
  1819. .LP
  1820.     CustomerIdentifier ::= CHOICE
  1821. .LP
  1822. \ {name
  1823.     VisibleString,
  1824. .LP
  1825.     \ number
  1826.     INTEGER}
  1827. .sp 1P
  1828. .LP
  1829. I.2.10.8\ \ Use a private\(hyuse tagged type to define a data type that finds
  1830. use within a particular organisation or country and that must be
  1831. distinguishable (by means of its representation) from all other data types 
  1832. used by that organisation or country. 
  1833. .sp 9p
  1834. .RT
  1835. .LP
  1836.     \fIExample:\fR 
  1837. .LP
  1838.     AcmeBadgeNumber ::= [PRIVATE 2] IMPLICIT INTEGER
  1839. .sp 1P
  1840. .LP
  1841. I.2.10.9\ \ These guidelines use implicit tagging in the examples whenever 
  1842. it is legal to do so. This may, depending on the encoding rules, result 
  1843. in a 
  1844. compact representation, which is highly desirable in some applications. In
  1845. other applications, compactness may be less important than, for example, the
  1846. ability to carry out strong type\(hychecking. In the latter case, explicit 
  1847. tagging can be used. 
  1848. .sp 9p
  1849. .RT
  1850. .PP
  1851. See also \(sc I.2.9.1, \(sc I.2.9.2, \(sc I.2.11.1 and \(sc I.2.11.2.
  1852. .sp 2P
  1853. .LP
  1854. I.2.11\ \ \fIChoice\fR 
  1855. .sp 1P
  1856. .RT
  1857. .sp 1P
  1858. .LP
  1859. I.2.11.1\ \ Use a CHOICE to model a variable that is selected from a
  1860. collection of variables whose number is known and modest. Identify each
  1861. candidate variable by context\(hyspecifically tagging it.
  1862. .sp 9p
  1863. .RT
  1864. .LP
  1865.     \fIExample:\fR 
  1866. .LP
  1867.     FileIdentifier ::= CHOICE
  1868. .LP
  1869. \ {relativeName
  1870.     [0] IMPLICIT VisibleString,
  1871. .LP
  1872.     \ \ \ \(hy\(hy\ name of file (for example, \*QMarchProgressReport\*U)
  1873. .LP
  1874.     \ absoluteName
  1875.     [1] IMPLICIT VisibleString,
  1876. .LP
  1877.     \ \ \ \(hy\(hy\ name of file and containing directory
  1878. .LP
  1879. \ \ \ \(hy\(hy\ (for example, \*Q<Williams>MarchProgressReport\*U)
  1880. .LP
  1881.     \ serialNumber
  1882.     [2] IMPLICIT INTEGER
  1883. .LP
  1884.     \ \ \ \(hy\(hy\ system\(hyassigned identifier for file\ \(hy\(hy}
  1885. .bp
  1886. .sp 1P
  1887. .LP
  1888. I.2.11.2\ \ Use a CHOICE to model a variable that is selected from a
  1889. collection of variables whose makeup is likely to change from one version of
  1890. the protocol to the next. Identify each candidate variable by
  1891. context\(hyspecifically tagging it.
  1892. .sp 9p
  1893. .RT
  1894. .LP
  1895.     \fIExample:\fR 
  1896. .LP
  1897.     FileIdentifier ::= CHOICE
  1898. .LP
  1899. \ {relativeName
  1900.     [0] IMPLICIT VisibleString,
  1901. .LP
  1902.     \ \ \ \(hy\(hy\ name of file (for example, \*QMarchProgressReport\*U)
  1903. .LP
  1904.     \ absoluteName
  1905.     [1] IMPLICIT VisibleString,
  1906. .LP
  1907.     \ \ \ \(hy\(hy\ name of file and containing directory
  1908. .LP
  1909. \ \ \ \(hy\(hy\ (for example, \*Q<Williams>MarchProgressReport\*U)
  1910. .LP
  1911. \ \(hy\(hy\ other forms of file identifiers are for further study\ \(hy\(hy}
  1912. .sp 1P
  1913. .LP
  1914. I.2.11.3\ \ A reference name should be assigned to each alternative whose
  1915. purpose is not fully evident from its type.
  1916. .sp 9p
  1917. .RT
  1918. .LP
  1919.     \fIExample:\fR 
  1920. .LP
  1921.     FileIdentifier ::= CHOICE
  1922. .LP
  1923. \ {relativeName
  1924.     [0] IMPLICIT VisibleString,
  1925. .LP
  1926.     \ \ \ \(hy\(hy\ name of file (for example, \*QMarchProgressReport\*U)
  1927. .LP
  1928.     \ absoluteName
  1929.     [1] IMPLICIT VisibleString,
  1930. .LP
  1931.     \ \ \ \(hy\(hy\ names of file and containing directory
  1932. .LP
  1933. \ \ \ \(hy\(hy\ (for example, \*Q<Williams>MarchProgressReport\*U)
  1934. .LP
  1935.     [2] IMPLICIT SerialNumber
  1936. .LP
  1937.     \ \ \ \(hy\(hy\ system\(hyassigned identifier for file\ \(hy\(hy}
  1938. .sp 1P
  1939. .LP
  1940. I.2.11.4\ \ Where implicit tagging is the norm in a particular application 
  1941. of this Recommendation, use a CHOICE of only one type where the possibility 
  1942. is 
  1943. envisaged or more than one type being permitted in the future. This precludes 
  1944. the possibility of implicit tagging taking place, and thus aids transition. 
  1945. .sp 9p
  1946. .RT
  1947. .LP
  1948.     \fIExample:\fR 
  1949. .LP
  1950.     Greeting ::= [APPLICATION 12] CHOICE
  1951. .LP
  1952.     {VisibleString}
  1953. .LP
  1954. in anticipation of
  1955. .LP
  1956.     Greeting ::= [APPLICATION 12] CHOICE
  1957. .LP
  1958.     {VisibleString,
  1959. .LP
  1960.     Voice}
  1961. .sp 2P
  1962. .LP
  1963. I.2.12\ \ \fISelection type\fR 
  1964. .sp 1P
  1965. .RT
  1966. .sp 1P
  1967. .LP
  1968. I.2.12.1\ \ Use a selection type to model a variable whose type is that of
  1969. some particular alternatives of a previously defined CHOICE.
  1970. .sp 9p
  1971. .RT
  1972. .sp 1P
  1973. .LP
  1974. I.2.12.2\ \ Consider the definition:
  1975. .sp 9p
  1976. .RT
  1977. .LP
  1978.     FileAttribute ::= CHOICE
  1979. .LP
  1980. {date\(hylast\(hyused
  1981.     INTEGER,
  1982. .LP
  1983.     \ file\(hyname 
  1984.     VisibleString}
  1985. .LP
  1986. then the following definition is possible:
  1987. .LP
  1988.     CurrentAttributes ::= SEQUENCE
  1989. .LP
  1990. {date\(hylast\(hyused 
  1991.     <FileAttribute,
  1992. .LP
  1993.     \ file\(hyname
  1994.     <FileAttribute}
  1995. .LP
  1996. with a possible value notation of
  1997. .LP
  1998.     {date\(hylast\(hyused 27
  1999. .LP
  2000. \ file\(hyname \*QPROGRAM\*U}
  2001. .bp
  2002. .PP
  2003. The following definition is also possible:
  2004. .LP
  2005.     AttributeList ::= SEQUENCE
  2006. .LP
  2007. {first\(hyattribute date\(hylast\(hyused 
  2008.     <FileAttribute,
  2009. .LP
  2010.     \ second\(hyattribute file\(hyname 
  2011.     <FileAttribute}
  2012. .LP
  2013. with a possible value notation of
  2014. .LP
  2015.     {first\(hyattribute 27,
  2016. .LP
  2017. \ second\(hyattribute \*QPROGRAM\*U}
  2018. .sp 2P
  2019. .LP
  2020. I.2.13\ \ \fIAny\fR 
  2021. .sp 1P
  2022. .RT
  2023. .sp 1P
  2024. .LP
  2025. I.2.13.1\ \ Use an any type to model a variable whose type is unspecified, 
  2026. or specified elsewhere using ASN.1. 
  2027. .sp 9p
  2028. .RT
  2029. .LP
  2030.     \fIExample:\fR 
  2031. .LP
  2032.     MessageContents ::= ANY
  2033. .LP
  2034. \ \(hy\(hy\ a data element whose type is specified
  2035. .LP
  2036. \ \(hy\(hy\ outside this Recommendation using the ASN.1 notation.
  2037. .sp 2P
  2038. .LP
  2039. I.2.14\ \ \fIExternal\fR 
  2040. .sp 1P
  2041. .RT
  2042. .sp 1P
  2043. .LP
  2044. I.2.14.1\ \ Use an external type to model a variable whose type is
  2045. unspecified, or specified elsewhere with no restriction on the notation 
  2046. used to specify the type. 
  2047. .sp 9p
  2048. .RT
  2049. .LP
  2050.     \fIExample:\fR 
  2051. .LP
  2052.     FileContents ::= EXTERNAL
  2053. .LP
  2054.     DocumentList ::= SEQUENCE OF EXTERNAL
  2055. .sp 1P
  2056. .LP
  2057. I.3
  2058.     \fIAn example of the use of the macro notation\fR 
  2059. .sp 9p
  2060. .RT
  2061. .PP
  2062. Suppose it is desired to have a notation for type definition of the form
  2063. .RT
  2064. .LP
  2065.     PAIR TYPEX = .\|.\|.\|. TYPEY = .\|.\|.\|.
  2066. .LP
  2067. with a corresponding value notation allowing
  2068. .LP
  2069.     (X = \(hy\(hy\(hy\(hy, Y = \(hy\(hy\(hy\(hy)
  2070. .PP
  2071. The .\|.\|.\|. and the \(hy\(hy\(hy\(hy refer to any ASN.1 type and corresponding 
  2072. value respectively. 
  2073. .PP
  2074. This macro type notation could be used to define types and values as   follows:
  2075. .RT
  2076. .LP
  2077.     T1 ::= PAIR
  2078. .LP
  2079.     TYPEX = INTEGER
  2080. .LP
  2081. TYPEY = BOOLEAN
  2082. .LP
  2083.     T2 ::= PAIR
  2084. .LP
  2085.     TYPEX = VisibleString
  2086. .LP
  2087. TYPEY = T1
  2088. .PP
  2089. Then a value of type T1 might be:
  2090. .LP
  2091.     (X = 3, Y = TRUE)
  2092. .LP
  2093. and a value of type T2 might be:
  2094. .LP
  2095.     (X = \*QName\*U, Y = (X = 4, Y = FALSE))
  2096. .bp
  2097. .PP
  2098. The following macro definition could be used to establish this new notation, 
  2099. as an extension of the basic ASN.1: 
  2100. .LP
  2101.     PAIR
  2102. .LP
  2103. MACRO ::= BEGIN
  2104. .LP
  2105. TYPE NOTATION ::=
  2106. .LP
  2107.     \*QTYPEX\*U
  2108. .LP
  2109. \*Q=\*U
  2110. .LP
  2111. type (Local\(hytype\(hy1)
  2112. .LP
  2113. \ \(hy\(hy\ Expects any ASN.1 type and assigns it
  2114. .LP
  2115. \ \(hy\(hy\ to the variable Local\(hytype\(hy1;
  2116. .LP
  2117. \*QTYPEY\*U
  2118. .LP
  2119. \*Q=\*U
  2120. .LP
  2121. type (Local\(hytype\(hy2)
  2122. .LP
  2123. \ \(hy\(hy\ Expects a second ASN.1 type and assigns
  2124. .LP
  2125. \ \(hy\(hy\ it to the variable Local\(hytype\(hy2;
  2126. .LP
  2127.     VALUE NOTATION ::=
  2128. .LP
  2129.     \*Q(\*U
  2130. .LP
  2131. \*QX\*U
  2132. .LP
  2133. \*Q=\*U
  2134. .LP
  2135. value (Local\(hyvalue\(hy1 Local\(hytype\(hy1)
  2136. .LP
  2137. \ \(hy\(hy\ Expects a value for the type in
  2138. .LP
  2139. \ \(hy\(hy\ Local\(hytype\(hy1, and assigns it
  2140. .LP
  2141. \ \(hy\(hy\ to the variable Local\(hyvalue\(hy1;
  2142. .LP
  2143. \*Q,\*U
  2144. .LP
  2145. \*QY\*U
  2146. .LP
  2147. \*Q=\*U
  2148. .LP
  2149. value (Local\(hyvalue\(hy2 Local\(hytype\(hy2)
  2150. .LP
  2151. \ \(hy\(hy\ Expects a value for the type in
  2152. .LP
  2153. \ \(hy\(hy\ Local\(hytype\(hy2 and assigns it
  2154. .LP
  2155. \ \(hy\(hy\ to the variable Local\(hyvalue\(hy2;
  2156. .LP
  2157. <VALUE SEQUENCE {Local\(hytype\(hy1, Local\(hytype\(hy2}
  2158. .LP
  2159. \ ::= {Local\(hyvalue\(hy1, Local\(hyvalue\(hy2}>
  2160. .LP
  2161. \(hy\(hy\ This \*Qembedded definition\*U returns
  2162. .LP
  2163. \(hy\(hy\ the final value as the value
  2164. .LP
  2165. \(hy\(hy\ of a sequence of the two types.
  2166. .LP
  2167. \*Q)\*U
  2168. .LP
  2169.     END
  2170. .PP
  2171. In this example, the basic ASN.1 type of the returned value is
  2172. independent of the actual instance of the value notation, but does depend on
  2173. the instance of the type notation that is used. In other cases, it may be
  2174. fully determined by the macro definition, or it may depend on the instance 
  2175. of the value notation that is used. Note, however, that in all cases it 
  2176. is the 
  2177. \*QVALUE NOTATION\*U production that needs to be examined in order to determine 
  2178. the type of the returned value. The \*QTYPE NOTATION\*U production simply 
  2179. defines the syntax for type definition, and establishes the initial value 
  2180. of local 
  2181. variables for use when analysing an instance of the value notation.
  2182. .sp 2P
  2183. .LP
  2184. I.4
  2185.     \fIUse in identifying abstract syntaxes\fR 
  2186. .sp 1P
  2187. .RT
  2188. .PP
  2189. I.4.1 
  2190. Use of the presentation service (Recommendation X.216) requires
  2191. the specification of values called \fBpresentation data values\fR and the 
  2192. grouping of those presentation data values into sets which are called \fBabstract\fR 
  2193. \fBsyntaxes\fR . Each of these sets is given an \fBabstract syntax name\fR 
  2194. of ASN.1 type object identifier. 
  2195. .sp 9p
  2196. .RT
  2197. .PP
  2198. I.4.2
  2199. ASN.1 can be used as a general tool in the specification of
  2200. presentation data values and their grouping into named abstract syntaxes.
  2201. .PP
  2202. I.4.3
  2203. In the simplest such use, there is a single ASN.1 type such that every 
  2204. presentation data value in the named abstract syntax is a value of that 
  2205. ASN.1 type. This type will normally be a choice type, and every presentation 
  2206. data value will be an alternative type from this choice type. In this case 
  2207. it is recommended that the ASN.1 module notation be used to contain this 
  2208. choice 
  2209. type as the first defined type, followed by the definition of those
  2210. (non\(hyuniversal) types referenced directly or indirectly by this choice type.
  2211. .PP
  2212. \fINote\fR \ \(em\ This is not intended to exclude references to types
  2213. defined in other modules.
  2214. .bp
  2215. .PP
  2216. I.4.4 
  2217. The following is an example of text which might appear in an
  2218. application standard. The end of the example is identified by the phrase 
  2219. \*QEND OF EXAMPLE\*U in order to avoid confusion. 
  2220. .sp 9p
  2221. .RT
  2222. .LP
  2223.     \fIExample:\fR 
  2224. .LP
  2225.     ISOxxxx\(hyyyyy DEFINITIONS ::=
  2226. .LP
  2227. BEGIN
  2228. .LP
  2229. PDU ::= CHOICE
  2230. .LP
  2231. \ \ {connect\(hypdu\ \ .\|.\|.,
  2232. .LP
  2233. \ \ \ data\(hypdu\ \ CHOICE
  2234. .LP
  2235. \ \ \ \ \ \ \ {\ .\|.\|.,
  2236. .LP
  2237. \ \ \ \ \ \ .\|.\|.}\ \ ,
  2238. .LP
  2239. \ \ .\|.\|.\ \ \ \ \ }
  2240. .LP
  2241. .\|.\|.
  2242. .LP
  2243. END
  2244. .LP
  2245.     This International Standard assigns the ASN.1 object identifier
  2246. value
  2247. .LP
  2248.     {iso standard xxxx abstract\(hysyntax (1)}
  2249. .LP
  2250.     as an abstract syntax name for the set of presentation data
  2251. values, each of which is a value of the ASN.1 type
  2252. \*QISOxxxx\(hyyyyy.PDU\*U.
  2253. .LP
  2254.     The corresponding ASN.1 object descriptor value shall be
  2255. .LP
  2256.     \*Q..............................\*U
  2257. .LP
  2258.     The ASN.1 object identifier and object descriptor values
  2259. .LP
  2260.     {joint\(hyiso\(hyccitt asn1 (1) basic\(hyencoding (1)}
  2261. .LP
  2262.     and
  2263. .LP
  2264.     \*QBasic Encoding of a single ASN.1 type\*U
  2265. .LP
  2266.     (assigned to an information object in Recommendation X.209) can be
  2267. used as a transfer syntax name with this abstract syntax name.
  2268. .LP
  2269.     END OF EXAMPLE
  2270. .PP
  2271. I.4.5 
  2272. The standard may additionally make support of the transfer syntax obtained 
  2273. by applying 
  2274. .sp 9p
  2275. .RT
  2276. .LP
  2277.     {joint\(hyiso\(hyccitt asn1 (1) basic\(hyencoding (1)}
  2278. .LP
  2279.     mandatory for this abstract syntax
  2280. .sp 2P
  2281. .LP
  2282. I.5
  2283.     \fISubtypes\fR 
  2284. .sp 1P
  2285. .RT
  2286. .PP
  2287. I.5.1 
  2288. Use subtypes to limit the values of an existing type which are to be permitted 
  2289. in a particular situation. 
  2290. .sp 9p
  2291. .RT
  2292. .LP
  2293.     \fIExamples:\fR 
  2294. .LP
  2295.     AtomicNumber ::=INTEGER (1..104)
  2296. .LP
  2297.     TouchToneString ::= IA5String (FROM
  2298. .LP
  2299.     (\*Q0\*U|\*Q1\*U|\*Q2\*U|\*Q3\*U|\*Q4\*U|\*Q5\*U|\*Q6\*U|
  2300. .LP
  2301. \*Q7\*U|\*Q8\*U|\*Q9\*U|\*Q*\*U|\*Q##\*U)|
  2302. .LP
  2303. SIZE (1..63))
  2304. .LP
  2305.     ParameterList ::= SET SIZE (0..63) OF Parameter
  2306. .LP
  2307.     SmallPrime ::= INTEGER (2|3|5|7|11|13|17|19|23|29)
  2308. .bp
  2309. .PP
  2310. I.5.2 
  2311. Where two or more related types have significant commonality,
  2312. consider explicitly defining their common parent as a type and use subtyping
  2313. for the individual types. This approach makes clear the relationship and the
  2314. commonality, and encourages (though does not force) this to continue as the
  2315. types evolve. It thus facilitates the use of common implementation approaches 
  2316. to the handling of values of these types. 
  2317. .sp 9p
  2318. .RT
  2319. .LP
  2320.     \fIExample:\fR 
  2321. .LP
  2322.     Envelope ::= SET {typeA TypeA,
  2323. .LP
  2324.     \ typeB TypeB OPTIONAL,
  2325. .LP
  2326. \ typeC TypeC OPTIONAL}
  2327. .LP
  2328. \ \(hy\(hy\ the common parent
  2329. .LP
  2330.     ABEnvelope ::= Envelope (WITH COMPONENTS
  2331. .LP
  2332.     \ {.\|.\|.,
  2333. .LP
  2334. \ typeB PRESENT, typeC ABSENT})
  2335. .LP
  2336. \ \(hy\(hy\ where typeB must always
  2337. .LP
  2338. \ \(hy\(hy\ appear and typeC must not
  2339. .LP
  2340.     ACEnvelope ::= Envelope (WITH COMPONENTS
  2341. .LP
  2342.     \ {.\|.\|.,
  2343. .LP
  2344. \ typeB ABSENT, typeC PRESENT})
  2345. .LP
  2346. \ \(hy\(hy\ where typeC must always
  2347. .LP
  2348. \ \(hy\(hy\ appear and typeB must not
  2349. .PP
  2350. The latter definitions could alternatively be expressed as
  2351. .LP
  2352.     ABEnvelope ::= Envelope (WITH COMPONENTS {typeA,typeB})
  2353. .LP
  2354.     ACEnvelope ::= Envelope (WITH COMPONENTS {typeA,typeC})
  2355. .PP
  2356. The choice between the alternatives would be made upon such
  2357. factors as the number of components in the parent type, and the number 
  2358. of those which are optional, the extent of the difference between the individual 
  2359. types, and the likely evolution strategy. 
  2360. .PP
  2361. I.5.3 
  2362. Use subtyping to partially define a value, for example, a protocol data 
  2363. unit to be tested for in a conformance test, where the test is concerned 
  2364. only with some components of the PDU. 
  2365. .sp 9p
  2366. .RT
  2367. .LP
  2368.     \fIExample:\fR 
  2369. .LP
  2370.     Given:
  2371. .LP
  2372.     PDU ::= SET
  2373. .LP
  2374.     {alpha 
  2375.     [0] 
  2376.     INTEGER,
  2377. .LP
  2378.     \ beta
  2379.     [1] 
  2380.     IA5String OPTIONAL,
  2381. .LP
  2382.     \ gamma 
  2383.     [2] 
  2384.     SEQUENCE OF Parameter,
  2385. .LP
  2386.     \ delta 
  2387.     [3] 
  2388.     BOOLEAN}
  2389. .LP
  2390. then in composing a test which requires the Boolean to be false
  2391. and the integer to be negative, write:
  2392. .LP
  2393.     TestPDU ::= PDU (WITH COMPONENTS
  2394. .LP
  2395.     {\ .\|.\|.,
  2396. .LP
  2397. \ delta (FALSE),
  2398. .LP
  2399. \ alpha (MIN.\|.\|.<0)})
  2400. .LP
  2401. and if, further, the IA5String, beta, is to be present and either
  2402. 5 or 12 characters in length, write:
  2403. .LP
  2404.     FurtherTestPDU ::= TestPDU (WITH COMPONENTS
  2405. .LP
  2406.     {\ .\|.\|.,
  2407. .LP
  2408. \ beta (SIZE (5|12)) PRESENT})
  2409. .bp
  2410. .PP
  2411. I.5.4 
  2412. If a general\(hypurpose datatype has been defined as a SEQUENCE OF, use 
  2413. subtyping to define a restricted subtype of the general type: 
  2414. .sp 9p
  2415. .RT
  2416. .LP
  2417.     \fIExample:\fR 
  2418. .LP
  2419.     Text\(hyblock ::= SEQUENCE OF VisibleString
  2420. .LP
  2421. Address ::= Text\(hyblock
  2422. .LP
  2423.     (SIZE (1..6) |
  2424. .LP
  2425. WITH COMPONENT (SIZE(1..32)))
  2426. .PP
  2427. I.5.5 
  2428. Use contained subtypes to form new subtypes from existing
  2429. subtypes:
  2430. .sp 9p
  2431. .RT
  2432. .LP
  2433.     \fIExample:\fR 
  2434. .LP
  2435.     Months ::= ENUMERATED {
  2436. .LP
  2437.     january (1),
  2438. .LP
  2439. february (2),
  2440. .LP
  2441. march (3),
  2442. .LP
  2443. april (4),
  2444. .LP
  2445. may (5),
  2446. .LP
  2447. june (6),
  2448. .LP
  2449. july (7),
  2450. .LP
  2451. august (8),
  2452. .LP
  2453. september (9),
  2454. .LP
  2455. october (10),
  2456. .LP
  2457. november (11),
  2458. .LP
  2459. december (12)}
  2460. .LP
  2461.     First\(hyquarter ::= Months (
  2462. .LP
  2463.     january\ |
  2464. .LP
  2465. february\ |
  2466. .LP
  2467. march)
  2468. .LP
  2469.     Second\(hyquarter ::= Months (
  2470. .LP
  2471.     april\ |
  2472. .LP
  2473. may\ |
  2474. .LP
  2475. june)
  2476. .LP
  2477.     Third\(hyquarter ::= Months (
  2478. .LP
  2479.     july\ |
  2480. .LP
  2481. august\ |
  2482. .LP
  2483. september)
  2484. .LP
  2485.     Fourth\(hyquarter ::= Months (
  2486. .LP
  2487.     october\ |
  2488. .LP
  2489. november\ |
  2490. .LP
  2491. december)
  2492. .LP
  2493.     First\(hyhalf ::= Months (
  2494. .LP
  2495.     INCLUDES First\(hyquarter\ |
  2496. .LP
  2497. INCLUDES Second\(hyquarter)
  2498. .LP
  2499.     Second\(hyhalf ::= Months (
  2500. .LP
  2501.     INCLUDES Third\(hyquarter\ |
  2502. .LP
  2503. INCLUDES Fourth\(hyquarter\ )
  2504. \v'1P'
  2505. .bp
  2506. .ce 1000
  2507. APPENDIX\ II
  2508. .ce 0
  2509. .ce 1000
  2510. (to Recommendation X.208)
  2511. .sp 9p
  2512. .RT
  2513. .ce 0
  2514. .ce 1000
  2515. \fBSummary of the ASN.1 notation\fR 
  2516. .sp 1P
  2517. .RT
  2518. .ce 0
  2519. .PP
  2520. The following items are defined in clause 8:
  2521. .sp 1P
  2522. .RT
  2523. .LP
  2524.     typereference
  2525.     INTEGER
  2526.     BEGIN
  2527. .LP
  2528.     identifier
  2529.     BIT
  2530.     END
  2531. .LP
  2532.     valuereference 
  2533.     STRING
  2534.     DEFINITIONS
  2535. .LP
  2536.     modulereference
  2537.     OCTET
  2538.     EXPLICIT
  2539. .LP
  2540.     comment
  2541.     NULL
  2542.     ENUMERATED
  2543. .LP
  2544.     empty
  2545.     SEQUENCE
  2546.     EXPORTS
  2547. .LP
  2548.     number
  2549.     OF
  2550.     IMPORTS
  2551. .LP
  2552.     bstring
  2553.     SET
  2554. .LP
  2555.     hstring
  2556.     IMPLICIT
  2557.     REAL
  2558. .LP
  2559.     cstring
  2560.     CHOICE
  2561.     INCLUDES
  2562. .LP
  2563.     \*Q::=\*U
  2564.     ANY
  2565.     MIN
  2566. .LP
  2567.     {
  2568.     EXTERNAL
  2569.     MAX
  2570. .LP
  2571.     }
  2572.     OBJECT
  2573.     SIZE
  2574. .LP
  2575.     <
  2576.     IDENTIFIER 
  2577.     FROM
  2578. .LP
  2579.     ,
  2580.     OPTIONAL
  2581.     WITH
  2582. .LP
  2583.     .
  2584.     DEFAULT
  2585.     COMPONENT
  2586. .LP
  2587.     (
  2588.     COMPONENTS 
  2589.     PRESENT
  2590. .LP
  2591.     )
  2592.     UNIVERSAL
  2593.     ABSENT
  2594. .LP
  2595.     [
  2596.     APPLICATION
  2597.     DEFINED
  2598. .LP
  2599.     ]
  2600.     PRIVATE
  2601.     BY
  2602. .LP
  2603.     \(hy
  2604.     TRUE
  2605.     PLUS\(hyINFINITY
  2606. .LP
  2607.     BOOLEAN
  2608.     FALSE
  2609.     MINUS\(hyINFINITY
  2610. .PP
  2611. The following productions are used in this Recommendation, with
  2612. the above items as terminal symbols:
  2613. .LP
  2614.     ModuleDefinition ::=
  2615. .LP
  2616.     ModuleIdentifier
  2617. .LP
  2618. DEFINITIONS
  2619. .LP
  2620. TagDefault
  2621. .LP
  2622. \*Q::=\*U
  2623. .LP
  2624. BEGIN
  2625. .LP
  2626. ModuleBody
  2627. .LP
  2628. END
  2629. .LP
  2630.     TagDefault ::=
  2631. .LP
  2632.     EXPLICIT TAGS\ |
  2633. .LP
  2634. IMPLICIT TAGS\ |
  2635. .LP
  2636. empty
  2637. .LP
  2638.     ModuleIdentifier ::=
  2639. .LP
  2640.     modulereference
  2641. .LP
  2642. AssignedIdentifier
  2643. .LP
  2644.     AssignedIdentifier ::=
  2645. .LP
  2646.     ObjectIdentifier Value\ |
  2647. .LP
  2648. empty
  2649. .LP
  2650.     ModuleBody ::=
  2651. .LP
  2652.     Exports Imports AssignmentList\ |
  2653. .LP
  2654. empty
  2655. .LP
  2656.     Exports ::=
  2657. .LP
  2658.     EXPORTS SymbolsExported;\ |
  2659. .LP
  2660. empty
  2661. .LP
  2662.     SymbolsExported ::=
  2663. .LP
  2664.     SymbolList\ |
  2665. .LP
  2666. empty
  2667. .bp
  2668. .LP
  2669.     Imports ::=
  2670. .LP
  2671.     IMPORTS SymbolsImported;\ |
  2672. .LP
  2673. empty
  2674. .LP
  2675.     SymbolsImported ::=
  2676. .LP
  2677.     SymbolsFromModuleList\ |
  2678. .LP
  2679. empty
  2680. .LP
  2681.     SymbolsFromModuleList ::=
  2682. .LP
  2683.     SymbolsFromModule SymbolsFromModuleList\ |
  2684. .LP
  2685. SymbolsFromModule
  2686. .LP
  2687.     SymbolsFromModule ::=
  2688. .LP
  2689.     SymbolList FROM ModuleIdentifier
  2690. .LP
  2691.     SymbolList ::= Symbol, SymbolList\ |\ Symbol
  2692. .LP
  2693.     Symbol ::= typereference\ |\ valuereference
  2694. .LP
  2695.     AssignmentList ::=
  2696. .LP
  2697.     Assignment AssignmentList\ |
  2698. .LP
  2699. Assignment
  2700. .LP
  2701.     Assignment ::= Typeassignment\ |\ Valueassignment
  2702. .LP
  2703.     Externaltypereference ::=
  2704. .LP
  2705.     modulereference
  2706. .LP
  2707. .
  2708. .LP
  2709. typereference
  2710. .LP
  2711.     Externalvaluereference ::=
  2712. .LP
  2713.     modulereference
  2714. .LP
  2715. .
  2716. .LP
  2717. valuereference
  2718. .LP
  2719.     DefinedType ::= Externaltypereference\ |\ typereference
  2720. .LP
  2721.     DefinedValue ::= Externalvaluereference\ |\ valuereference
  2722. .LP
  2723.     Typeassignment ::=
  2724. .LP
  2725.     typereference
  2726. .LP
  2727. \*Q::=\*U
  2728. .LP
  2729. Type
  2730. .LP
  2731.     Valueassignment ::=
  2732. .LP
  2733.     valuereference
  2734. .LP
  2735. Type
  2736. .LP
  2737. \*Q::=\*U
  2738. .LP
  2739. Value
  2740. .LP
  2741.     Type ::= BuiltinType\ |\ DefinedType\ |\ Subtype
  2742. .LP
  2743.     BuiltinType ::=
  2744. .LP
  2745.     BooleanType
  2746. |
  2747. .LP
  2748.     IntegerType
  2749. |
  2750. .LP
  2751.     BitStringType
  2752. |
  2753. .LP
  2754.     OctetStringType
  2755. |
  2756. .LP
  2757.     NullType
  2758. |
  2759. .LP
  2760.     SequenceType
  2761. |
  2762. .LP
  2763.     SequenceOfType
  2764. |
  2765. .LP
  2766.     SetType
  2767. |
  2768. .LP
  2769.     SetOfType
  2770. |
  2771. .LP
  2772.     ChoiceType
  2773. |
  2774. .LP
  2775.     SelectionType
  2776. |
  2777. .LP
  2778.     TaggedType
  2779. |
  2780. .LP
  2781.     AnyType
  2782. |
  2783. .LP
  2784.     ObjectIdentifierType 
  2785. |
  2786. .LP
  2787.     CharacterStringType
  2788. |
  2789. .LP
  2790.     UsefulType
  2791. |
  2792. .LP
  2793.     EnumeratedType
  2794. |
  2795. .LP
  2796.     RealType
  2797. |
  2798. .bp
  2799. .LP
  2800.     NamedType ::= identifier Type\ |\ Type\ |\ SelectionType
  2801. .LP
  2802.     Value ::= BuiltinValue\ |\ DefinedValue
  2803. .LP
  2804. BuiltinValue ::=
  2805. .LP
  2806.     BooleanValue
  2807. |
  2808. .LP
  2809.     IntegerValue
  2810. |
  2811. .LP
  2812.     BitStringValue
  2813. |
  2814. .LP
  2815.     OctetStringValue
  2816. |
  2817. .LP
  2818.     NullValue
  2819. |
  2820. .LP
  2821.     SequenceValue
  2822. |
  2823. .LP
  2824.     SequenceOfValue
  2825. |
  2826. .LP
  2827.     SetValue
  2828. |
  2829. .LP
  2830.     SetOfValue
  2831. |
  2832. .LP
  2833.     ChoiceValue
  2834. |
  2835. .LP
  2836.     SelectionValue
  2837. |
  2838. .LP
  2839.     TaggedValue
  2840. |
  2841. .LP
  2842.     AnyValue
  2843. |
  2844. .LP
  2845.     ObjectIdentifierValue
  2846. |
  2847. .LP
  2848.     CharacterStringValue 
  2849. |
  2850. .LP
  2851.     EnumeratedValue
  2852. |
  2853. .LP
  2854.     RealValue
  2855. |
  2856. .LP
  2857.     NamedValue ::= identifier Value\ |\ Value
  2858. .LP
  2859.     BooleanType ::= BOOLEAN
  2860. .LP
  2861.     BooleanValue ::= TRUE\ |\ FALSE
  2862. .LP
  2863.     IntegerType ::= INTEGER\ |\ INTEGER {NamedNumberList}
  2864. .LP
  2865.     NamedNumberList ::=
  2866. .LP
  2867.     NamedNumber\ |
  2868. .LP
  2869. NamedNumberList,NamedNumber
  2870. .LP
  2871.     NamedNumber ::=
  2872. .LP
  2873.     identifier(SignedNumber)\ |
  2874. .LP
  2875. identifier(DefinedValue)
  2876. .LP
  2877.     SignedNumber ::= number\ |\ \(hynumber
  2878. .LP
  2879.     IntegerValue ::= SignedNumber\ |\ identifier
  2880. .LP
  2881.     EnumeratedType ::= ENUMERATED {Enumeration}
  2882. .LP
  2883.     Enumeration ::=
  2884. .LP
  2885.     NamedNumber\ |
  2886. .LP
  2887.     NamedNumber, Enumeration
  2888. .LP
  2889.     EnumeratedValue ::= identifier
  2890. .LP
  2891.     RealType ::= REAL
  2892. .LP
  2893.     RealValue ::= NumericRealValue\ |\ SpecialRealValue
  2894. .LP
  2895.     NumericRealValue ::= {Mantissa, Base, Exponent}\ |\ 0
  2896. .LP
  2897.     Mantissa ::= SignedNumber
  2898. .LP
  2899.     Base ::= 2\ |\ 10
  2900. .LP
  2901.     Exponent ::= SignedNumber
  2902. .LP
  2903.     SpecialRealValue ::= PLUS\(hyINFINITY\ |\ MINUS\(hyINFINITY
  2904. .LP
  2905.     BitStringType ::= BIT STRING\ |\ BIT STRING {NamedBitList}
  2906. .LP
  2907.     NamedBitList ::= NamedBit\ |\ NamedBitList,NamedBit
  2908. .LP
  2909.     NamedBit ::=
  2910. .LP
  2911.     identifier(number)\ |
  2912. .LP
  2913. identifier(DefinedValue)
  2914. .bp
  2915. .LP
  2916.     BitStringValue ::= bstring\ |\ hstring\ |{IdentifierList}\ |\ {\|}
  2917. .LP
  2918.     IdentifierList ::= identifier\ |\ IdentifierList,identifier
  2919. .LP
  2920.     OctetStringType ::= OCTET STRING
  2921. .LP
  2922.     OctetStringValue ::= bstring\ |\ hstring
  2923. .LP
  2924.     NullType ::= NULL
  2925. .LP
  2926.     NullValue ::= NULL
  2927. .LP
  2928.     SequenceType ::=
  2929. .LP
  2930.     SEQUENCE {ElementTypeList}\ |
  2931. .LP
  2932. SEQUENCE {\|}
  2933. .LP
  2934.     ElementTypeList ::=
  2935. .LP
  2936.     ElementType\ |
  2937. .LP
  2938. ElementTypeList,ElementType
  2939. .LP
  2940.     ElementType ::=
  2941. .LP
  2942.     NamedType\ |
  2943. .LP
  2944. NamedType OPTIONAL\ |
  2945. .LP
  2946. NamedType DEFAULT Value\ |
  2947. .LP
  2948. COMPONENTS OF Type
  2949. .LP
  2950.     SequenceValue ::= {ElementValueList}\ |\ {\|}
  2951. .LP
  2952.     ElementValueList ::=
  2953. .LP
  2954.     NamedValue\ |
  2955. .LP
  2956. ElementValueList,NamedValue
  2957. .LP
  2958.     SequenceOfType ::= SEQUENCE OF Type\ |\ SEQUENCE
  2959. .LP
  2960.     SequenceOfValue ::= {ValueList}\ |\ {\|}
  2961. .LP
  2962.     ValueList ::= Value\ |\ ValueList,Value
  2963. .LP
  2964.     SetType ::= SET{ElementTypeList}\ |\ SET {\|}
  2965. .LP
  2966.     SetValue ::= {ElementValueList}\ |\ {\|}
  2967. .LP
  2968.     SetOfType ::= SET OF Type\ |\ SET
  2969. .LP
  2970.     SetOfValue ::= {ValueList}\ |\ {\|}
  2971. .LP
  2972.     ChoiceType ::= CHOICE{AlternativeTypeList}
  2973. .LP
  2974.     AlternativeTypeList ::=
  2975. .LP
  2976.     NamedType\ |
  2977. .LP
  2978. AlternativeTypeList,NamedType
  2979. .LP
  2980.     ChoiceValue ::= NamedValue
  2981. .LP
  2982.     SelectionType ::= identifier < Type
  2983. .LP
  2984.     SelectionValue ::= NamedValue
  2985. .LP
  2986.     TaggedType ::=
  2987. .LP
  2988.     Tag Type\ |
  2989. .LP
  2990. Tag IMPLICIT Type\ |
  2991. .LP
  2992. Tag EXPLICIT Type
  2993. .LP
  2994.     Tag ::= [Class ClassNumber]
  2995. .LP
  2996.     ClassNumber ::= number\ |\ DefinedValue
  2997. .LP
  2998.     Class ::=
  2999. .LP
  3000.     UNIVERSAL\ |
  3001. .LP
  3002. APPLICATION\ |
  3003. .LP
  3004. PRIVATE\ |
  3005. .LP
  3006. empty
  3007. .bp
  3008. .LP
  3009.     TaggedValue ::= Value
  3010. .LP
  3011.     AnyType ::=
  3012. .LP
  3013.     ANY\ |
  3014. .LP
  3015. ANY DEFINED BY identifier
  3016. .LP
  3017.     AnyValue ::= Type Value
  3018. .LP
  3019.     ObjectIdentifierType ::= OBJECT IDENTIFIER
  3020. .LP
  3021.     ObjectIdentifierValue ::=
  3022. .LP
  3023.     {ObjIdComponentList}\ |
  3024. .LP
  3025. {DefinedValue ObjIdComponentList}
  3026. .LP
  3027.     ObjIdComponentList ::=
  3028. .LP
  3029.     ObjIdComponent\ |
  3030. .LP
  3031. ObjIdComponent ObjIdComponentList
  3032. .LP
  3033.     ObjIdComponent ::=
  3034. .LP
  3035.     NameForm\ |
  3036. .LP
  3037. NumberForm\ |
  3038. .LP
  3039. NameAndNumberForm
  3040. .LP
  3041.     NameForm ::= identifier
  3042. .LP
  3043.     NumberForm ::= number\ |\ DefinedValue
  3044. .LP
  3045.     NameAndNumberForm ::= identifier(NumberForm)
  3046. .LP
  3047.     CharacterStringType ::= typereference
  3048. .LP
  3049.     CharacterStringValue ::= cstring
  3050. .LP
  3051.     UsefulType ::= typereference
  3052. .PP
  3053. The following characterstring types are defined in section two:
  3054. .LP
  3055.     NumericString
  3056.     VisibleString
  3057. .LP
  3058.     PrintableString
  3059.     ISO646String
  3060. .LP
  3061.     TeletexString
  3062.     IA5String
  3063. .LP
  3064.     T61String
  3065.     GraphicString
  3066. .LP
  3067.     VideotexString
  3068.     GeneralString
  3069. .PP
  3070. The following useful types are defined in section three:
  3071. .LP
  3072.     GeneralizedTime
  3073.     EXTERNAL
  3074. .LP
  3075.     UTCTime
  3076.     ObjectDescriptor
  3077. .PP
  3078. The following productions are used in section four:
  3079. .LP
  3080.     Subtype ::=
  3081. .LP
  3082.     ParentType SubtypeSpec\ |
  3083. .LP
  3084. SET SizeConstraint OF Type\ |
  3085. .LP
  3086. SEQUENCE SizeConstraint OF Type
  3087. .LP
  3088.     ParentType ::= Type
  3089. .LP
  3090.     SubtypeSpec ::=
  3091. .LP
  3092.     (SubtypeValueSet SubtypeValueSetList)
  3093. .LP
  3094.     SubtypeValueSetList ::=
  3095. .LP
  3096.     \*Q|\*U
  3097. .LP
  3098. SubtypeValueSet
  3099. .LP
  3100. SubtypeValueSetList\ |
  3101. .LP
  3102. empty
  3103. .LP
  3104.     SubtypeValueSet ::=
  3105. .LP
  3106.     SingleValue\ |
  3107. .LP
  3108. ContainedSubtype\ |
  3109. .LP
  3110. ValueRange\ |
  3111. .LP
  3112. PermittedAlphabet\ |\ SizeConstraint\ |\ InnerTypeConstraint
  3113. .LP
  3114. SingleValue ::= Value
  3115. .LP
  3116. ContainedSubtype ::= INCLUDES Type
  3117. .LP
  3118. ValueRange ::= LowerEndPoint\ .\|.\ UpperEndPoint
  3119. .bp
  3120. .LP
  3121.     LowerEndpoint ::= LowerEndValue\ |\ LowerEndValue <
  3122. .LP
  3123.     UpperEndpoint ::= UpperEndValue\ |\ <UpperEndValue
  3124. .LP
  3125.     LowerEndValue ::= Value\ |\ MIN
  3126. .LP
  3127.     UpperEndValue ::= Value\ |\ MAX
  3128. .LP
  3129.     SizeConstraint ::= SIZE SubtypeSpec
  3130. .LP
  3131.     PermittedAlphabet ::= FROM SubtypeSpec
  3132. .LP
  3133.     InnerTypeConstraints ::=
  3134. .LP
  3135.     WITH\ COMPONENT SingleTypeConstraint\ |
  3136. .LP
  3137. WITH\ COMPONENTS MultipleTypeConstraints
  3138. .LP
  3139.     SingleTypeConstraint ::= SubtypeSpec
  3140. .LP
  3141.     MultipleTypeConstraints ::=
  3142. .LP
  3143.     FullSpecification\ |\ PartialSpecification
  3144. .LP
  3145.     FullSpecification ::= {TypeConstraints}
  3146. .LP
  3147.     PartialSpecification ::= {.\|.\|., TypeConstraints}
  3148. .LP
  3149.     TypeConstraints ::=
  3150. .LP
  3151.     NamedConstraint\ |
  3152. .LP
  3153. NamedConstraint, TypeConstraints
  3154. .LP
  3155.     NamedConstraint ::= identifier Constraint\ |\ Constraint
  3156. .LP
  3157.     Constraint ::= ValueConstraint PresenceConstraint
  3158. .LP
  3159. ValueConstraint ::= SubtypeSpec\ |\ empty
  3160. .LP
  3161. PresenceConstraint ::= PRESENT\ |\ ABSENT\ |\ empty\ |\ OPTIONAL
  3162. .PP
  3163. The following additional items are defined in \(sc A.2 for use
  3164. in the macro notation:
  3165. .LP
  3166.     macroreference
  3167.     \*Qnumber\*U
  3168. .LP
  3169.     productionreference
  3170.     \*Qempty\*U
  3171. .LP
  3172.     localtypereference
  3173.     MACRO
  3174. .LP
  3175.     localvaluereference
  3176.     TYPE
  3177. .LP
  3178.     \*Q|\*U
  3179.     NOTATION
  3180. .LP
  3181.     >
  3182.     VALUE
  3183. .LP
  3184.     astring
  3185.     value
  3186. .LP
  3187.     \*Qstring\*U
  3188.     type
  3189. .LP
  3190.     \*Qidentifier\*U
  3191. .PP
  3192. The following productions are used in Annex A, with the above
  3193. items, and items listed at the head of this appendix, as terminal symbols:
  3194. .LP
  3195.     MacroDefinition ::=
  3196. .LP
  3197.     macroreference
  3198. .LP
  3199. MACRO
  3200. .LP
  3201. \*Q::=\*U
  3202. .LP
  3203. MacroSubstance
  3204. .LP
  3205.     MacroSubstance ::=
  3206. .LP
  3207.     BEGIN MacroBody END\ |
  3208. .LP
  3209. macroreference\ |
  3210. .LP
  3211. Externalmacroreference
  3212. .LP
  3213.     MacroBody ::=
  3214. .LP
  3215.     TypeProduction
  3216. .LP
  3217. ValueProduction
  3218. .LP
  3219. SupportingProductions
  3220. .LP
  3221.     TypeProduction ::=
  3222. .LP
  3223.     TYPE NOTATION
  3224. .LP
  3225. \*Q::=\*U
  3226. .LP
  3227. MacroAlternativeList
  3228. .bp
  3229. .LP
  3230.     ValueProduction ::=
  3231. .LP
  3232.     VALUE NOTATION
  3233. .LP
  3234. \*Q::=\*U
  3235. .LP
  3236. MacroAlternativeList
  3237. .LP
  3238.     SupportingProductions ::= ProductionList\ |\ empty
  3239. .LP
  3240.     ProductionList ::= Production\ |\ ProductionList Production
  3241. .LP
  3242.     Production ::=
  3243. .LP
  3244.     productionreference
  3245. .LP
  3246. \*Q::=\*U
  3247. .LP
  3248. MacroAlternativeList
  3249. .LP
  3250.     Externalmacroreference ::=
  3251. .LP
  3252.     modulereference\|.\|macroreference
  3253. .LP
  3254.     MacroAlternativeList ::=
  3255. .LP
  3256.     MacroAlternative\ |
  3257. .LP
  3258. MacroAlternativeList \*Q|\*U MacroAlternative
  3259. .LP
  3260.     MacroAlternative ::= SymbolList
  3261. .LP
  3262.     SymbolList ::= SymbolElement\ |\ SymbolList SymbolElement
  3263. .LP
  3264.     SymbolElement ::= SymbolDefn\ |\ EmbeddedDefinitions
  3265. .LP
  3266.     SymbolDefn ::=
  3267. .LP
  3268.     astring\ |
  3269. .LP
  3270. productionreference\ |
  3271. .LP
  3272. \*Qstring\*U\ |
  3273. .LP
  3274. \*Qidentifier\*U\ |
  3275. .LP
  3276. \*Qnumber\*U\ |
  3277. .LP
  3278. \*Qempty\*U\ |
  3279. .LP
  3280. type\ |
  3281. .LP
  3282. type(localtypereference)\ |
  3283. .LP
  3284. value(MacroType)\ |
  3285. .LP
  3286. value(localvaluereference MacroType)\ |
  3287. .LP
  3288. value(VALUE MacroType)
  3289. .LP
  3290.     MacroType ::= localtypereference\ |\ Type
  3291. .LP
  3292.     EmbeddedDefinitions ::= <EmbeddedDefinitionList>
  3293. .LP
  3294.     EmbeddedDefinitionList ::=
  3295. .LP
  3296.     EmbeddedDefinition\ |
  3297. .LP
  3298. EmbeddedDefinitionList EmbeddedDefinition
  3299. .LP
  3300.     EmbeddedDefinition ::=
  3301. .LP
  3302.     LocalTypeassignment\ |
  3303. .LP
  3304. LocalValueassignment
  3305. .LP
  3306.     LocalTypeassignment ::=
  3307. .LP
  3308.     Localtypereference
  3309. .LP
  3310. \*Q::=\*U
  3311. .LP
  3312. MacroType
  3313. .LP
  3314.     LocalValueassignment ::=
  3315. .LP
  3316.     localvaluereference
  3317. .LP
  3318. MacroType
  3319. .LP
  3320. \*Q::=\*U
  3321. .LP
  3322. MacroValue
  3323. .LP
  3324.     MacroValue ::= Value\ |\ localvaluereference
  3325. .bp
  3326. .sp 2P
  3327. .LP
  3328. \fBRecommendation\ X.209\fR 
  3329. .RT
  3330. .sp 2P
  3331. .ce 1000
  3332. \fBSPECIFICATION\ OF\ BASIC\ ENCODING\ RULES\ FOR\fR 
  3333. .EF '%    Fascicle\ VIII.4\ \(em\ Rec.\ X.209''
  3334. .OF '''Fascicle\ VIII.4\ \(em\ Rec.\ X.209    %'
  3335. .ce 0
  3336. .sp 1P
  3337. .ce 1000
  3338. \fBABSTRACT\ SYNTAX\ NOTATION\ ONE\ (ASN.1)\fR 
  3339. .FS
  3340. Recommendation\ X.209 and ISO 8825 [Information processing systems \(em\ 
  3341. Open systems interconnection\ \(em Specification of basic encoding rules 
  3342. for abstract Syntax Notation One\ (ASN.1)] as extended by Addendum\ 1 to 
  3343. ISO\ 8825, were developed in close cooperation and are technically aligned. 
  3344. .FE
  3345. .ce 0
  3346. .sp 1P
  3347. .ce 1000
  3348. \fI(Melbourne, 1988)\fR 
  3349. .sp 9p
  3350. .RT
  3351. .ce 0
  3352. .sp 1P
  3353. .LP
  3354.     The\ CCITT,
  3355. .sp 1P
  3356. .RT
  3357. .sp 1P
  3358. .LP
  3359. \fIconsidering\fR 
  3360. .sp 9p
  3361. .RT
  3362. .PP
  3363. (a)
  3364. the variety and complexity of information objects
  3365. conveyed within the application layer;
  3366. .PP
  3367. (b)
  3368. the need for a high\(hylevel notation for specifying such information objects;
  3369. .PP
  3370. (c)
  3371. the value of isolating and standardizing the rules for encoding such information 
  3372. objects. 
  3373. .sp 1P
  3374. .LP
  3375. \fIunanimously recommends\fR 
  3376. .sp 9p
  3377. .RT
  3378. .PP
  3379. that the rules for encoding information objects are defined in
  3380. this Recommendation.
  3381. .sp 1P
  3382. .ce 1000
  3383. CONTENTS
  3384. .ce 0
  3385. .sp 1P
  3386. .sp 2P
  3387. .LP
  3388. 0
  3389.     \fIIntroduction\fR 
  3390. .sp 1P
  3391. .RT
  3392. .sp 1P
  3393. .LP
  3394. 1
  3395.     \fIScope and field of application\fR 
  3396. .sp 9p
  3397. .RT
  3398. .sp 1P
  3399. .LP
  3400. 2
  3401.     \fIReferences\fR 
  3402. .sp 9p
  3403. .RT
  3404. .sp 1P
  3405. .LP
  3406. 3
  3407.     \fIDefinitions\fR 
  3408. .sp 9p
  3409. .RT
  3410. .sp 1P
  3411. .LP
  3412. 4
  3413.     \fIAbbreviations and notation\fR 
  3414. .sp 9p
  3415. .RT
  3416. .LP
  3417.     4.1
  3418.     Abbreviations
  3419. .LP
  3420.     4.2
  3421.     Notation
  3422. .sp 1P
  3423. .LP
  3424. 5
  3425.     \fIConformance\fR 
  3426. .sp 9p
  3427. .RT
  3428. .sp 1P
  3429. .LP
  3430. 6
  3431.     \fIGeneral rules for encoding\fR 
  3432. .sp 9p
  3433. .RT
  3434. .LP
  3435.     6.1
  3436.     Structure of an encoding
  3437. .LP
  3438.     6.2
  3439.     Identifier octets
  3440. .LP
  3441.     6.3
  3442.     Length octets
  3443. .LP
  3444.     6.4
  3445.     Contents octets
  3446. .LP
  3447.     6.5
  3448.     End\(hyof\(hycontents octets
  3449. .sp 1P
  3450. .LP
  3451. 7
  3452.     \fIEncoding of a Boolean value\fR 
  3453. .sp 9p
  3454. .RT
  3455. .sp 1P
  3456. .LP
  3457. 8
  3458.     \fIEncoding of an integer value\fR 
  3459. .sp 9p
  3460. .RT
  3461. .sp 1P
  3462. .LP
  3463. 9
  3464.     \fIEncoding of an enumerated value\fR 
  3465. .sp 9p
  3466. .RT
  3467. .sp 1P
  3468. .LP
  3469. 10
  3470.     \fIEncoding of a real value\fR 
  3471. .sp 9p
  3472. .RT
  3473. .sp 1P
  3474. .LP
  3475. 11
  3476.     \fIEncoding of a bitstring value\fR .bp
  3477. .sp 9p
  3478. .RT
  3479. .sp 1P
  3480. .LP
  3481. 12
  3482.     \fIEncoding of an octetstring value\fR 
  3483. .sp 9p
  3484. .RT
  3485. .sp 1P
  3486. .LP
  3487. 13
  3488.     \fIEncoding of a null value\fR 
  3489. .sp 9p
  3490. .RT
  3491. .sp 1P
  3492. .LP
  3493. 14
  3494.     \fIEncoding of a sequence value\fR 
  3495. .sp 9p
  3496. .RT
  3497. .sp 1P
  3498. .LP
  3499. 15
  3500.     \fIEncoding of a sequence\(hyof value\fR 
  3501. .sp 9p
  3502. .RT
  3503. .sp 1P
  3504. .LP
  3505. 16
  3506.     \fIEncoding of a set value\fR 
  3507. .sp 9p
  3508. .RT
  3509. .sp 1P
  3510. .LP
  3511. 17
  3512.     \fIEncoding of a set\(hyof value\fR 
  3513. .sp 9p
  3514. .RT
  3515. .sp 1P
  3516. .LP
  3517. 18
  3518.     \fIEncoding of a choice value\fR 
  3519. .sp 9p
  3520. .RT
  3521. .sp 1P
  3522. .LP
  3523. 19
  3524.     \fIEncoding of a selection value\fR 
  3525. .sp 9p
  3526. .RT
  3527. .sp 1P
  3528. .LP
  3529. 20
  3530.     \fIEncoding of a tagged value\fR 
  3531. .sp 9p
  3532. .RT
  3533. .sp 1P
  3534. .LP
  3535. 21
  3536.     \fIEncoding of a value of the ANY type\fR 
  3537. .sp 9p
  3538. .RT
  3539. .sp 1P
  3540. .LP
  3541. 22
  3542.     \fIEncoding of an object identifier value\fR 
  3543. .sp 9p
  3544. .RT
  3545. .sp 1P
  3546. .LP
  3547. 23
  3548.     \fIEncoding for values of the character string types\fR 
  3549. .sp 9p
  3550. .RT
  3551. .sp 1P
  3552. .LP
  3553. 24
  3554.     \fIEncoding for values of the ASN.1 useful types\fR 
  3555. .sp 9p
  3556. .RT
  3557. .sp 1P
  3558. .LP
  3559. 25
  3560.     \fIUse in transfer syntax definition\fR 
  3561. .sp 9p
  3562. .RT
  3563. .sp 1P
  3564. .LP
  3565. \fIAppendix\ I\fR \ \(em\ Example of encodings
  3566. .sp 9p
  3567. .RT
  3568. .LP
  3569.     I.1
  3570.     ASN.1 description of the record structure
  3571. .LP
  3572.     I.2
  3573.     ASN.1 description of a record value
  3574. .LP
  3575.     I.3
  3576.     Representation of this record value
  3577. .sp 1P
  3578. .LP
  3579. \fIAppendix\ II\fR \ \(em\ Assignment of object identifier values
  3580. .sp 9p
  3581. .RT
  3582. .sp 1P
  3583. .LP
  3584. \fIAppendix\ III\fR \ \(em\ Illustration of real value encoding
  3585. .sp 9p
  3586. .RT
  3587. .sp 2P
  3588. .LP
  3589. \fB0\fR     \fBIntroduction\fR 
  3590. .sp 1P
  3591. .RT
  3592. .PP
  3593. Recommendation X.208 (Specification of Abstract Syntax Notation
  3594. One) specifies a notation for the definition of abstract syntaxes, enabling
  3595. application layer specifications to define the types of information they 
  3596. need to transfer using the presentation service. It also specifies a notation 
  3597. for 
  3598. the specification of value of a defined type.
  3599. .PP
  3600. This Recommendation defines a set of encoding rules that may be
  3601. applied to values of types defined using the notation specified in
  3602. Recommendation\ X.208. Application of these encoding rules produces a transfer 
  3603. syntax for such values. It is implicit in the specification of these encoding 
  3604. rules that they are also to be used for decoding. 
  3605. .PP
  3606. There may be more than one set of encoding rules that can be applied to 
  3607. values of types that are defined using the notation of Recommendation\ 
  3608. X.208. This Recommendation defines one set of encoding rules, called \fBbasic 
  3609. encoding\fR \fBrules\fR . 
  3610. .PP
  3611. This Recommendation is technically and editorially aligned with ISO
  3612. 8825 plus Addendum\ 1 to ISO\ 8825.
  3613. .PP
  3614. Appendix I gives examples of the application of the encoding rules. It 
  3615. is not part of this Recommendation. 
  3616. .PP
  3617. Appendix II summarises the assignment of object identifier values made 
  3618. in this Recommendation and is not part of this Recommendation. 
  3619. .PP
  3620. Appendix III is not part of this Recommendation, and gives examples of 
  3621. applying the rules for encoding reals. 
  3622. .bp
  3623. .RT
  3624. .sp 2P
  3625. .LP
  3626. \fB1\fR     \fBScope and field of application\fR 
  3627. .sp 1P
  3628. .RT
  3629. .PP
  3630. This Recommendation specifies a set of basic encoding rules that
  3631. may be used to derive the specification of a transfer syntax for values of
  3632. types defined using the notation specified in Recommendation\ X.208. These 
  3633. basic encoding rules are also to be applied for decoding such a transfer 
  3634. syntax in 
  3635. order to identify the data values being transferred.
  3636. .PP
  3637. These basic encoding rules are used at the time of communication (by the 
  3638. presentation service provider when required by a presentation 
  3639. context).
  3640. .RT
  3641. .sp 2P
  3642. .LP
  3643. \fB2\fR     \fBReferences\fR 
  3644. .sp 1P
  3645. .RT
  3646. .LP
  3647. [1]
  3648.      Recommendation X.200, \fIReference Model of Open Systems Interconnection\fR 
  3649. \fIfor CCITT Applications\fR (see also ISO\ 7498). 
  3650. .LP
  3651. [2]
  3652.      Recommendation X.208, \fISpecification of Abstract Syntax Notation One\fR 
  3653. \fI(ASN.1)\fR (see also ISO\ 8824). 
  3654. .LP
  3655. [3]
  3656.     Recommendation X.226, \fIPresentation Protocol Specification for Open\fR 
  3657. \fISystems Interconnection for CCITT Applications\fR (see also ISO\ 8823).
  3658. .LP
  3659. [4]
  3660.      ISO 2022, \fIInformation processing\ \(em\ ISO\ 7\(hybit and 8\(hybit 
  3661. coded\fR 
  3662. \fIcharacter sets\fR \ \(em\ \fICode extension techniques\fR .
  3663. .LP
  3664. [5]
  3665.      ISO 2375, \fIData processing\fR \ \(em\ \fIProcedure for registration 
  3666. of escape\fR 
  3667. \fIsequences\fR .
  3668. .LP
  3669. [6]
  3670.      ISO 6093, \fIInformation processing\fR \ \(em\ \fIRepresentation of numerical\fR 
  3671. \fIvalues in character strings for information interchange\fR .
  3672. .sp 2P
  3673. .LP
  3674. \fB3\fR     \fBDefinitions\fR 
  3675. .sp 1P
  3676. .RT
  3677. .PP
  3678. The definitions of Recommendation X.208 are used in this
  3679. Recommendation.
  3680. .RT
  3681. .sp 1P
  3682. .LP
  3683. 3.1
  3684.     \fBdynamic conformance\fR 
  3685. .sp 9p
  3686. .RT
  3687. .PP
  3688. A statement of the requirement for an implementation to adhere to the behaviour 
  3689. prescribed by this Recommendation in an instance of 
  3690. communication.
  3691. .RT
  3692. .sp 1P
  3693. .LP
  3694. 3.2
  3695.     \fBstatic conformance\fR 
  3696. .sp 9p
  3697. .RT
  3698. .PP
  3699. A statement of the requirement for support by an implementation of a valid 
  3700. set of features from among those defined by this Recommendation. 
  3701. .RT
  3702. .sp 1P
  3703. .LP
  3704. 3.3
  3705.     \fBdata value\fR 
  3706. .sp 9p
  3707. .RT
  3708. .PP
  3709. Information specified as the value of a type; the type and the
  3710. value are defined using ASN.1.
  3711. .RT
  3712. .sp 1P
  3713. .LP
  3714. 3.4
  3715.     \fBencoding (of a data value)\fR 
  3716. .sp 9p
  3717. .RT
  3718. .PP
  3719. The complete sequence of octets used to represent the data
  3720. value.
  3721. .PP
  3722. \fINote\fR \ \(em\ Some CCITT Recommendations use the term \*Qdata element\*U 
  3723. for 
  3724. this sequence of octets, but the term is not used in this Recommendation, as
  3725. ISO International Standard use it to mean \*Qdata value\*U.
  3726. .RT
  3727. .sp 1P
  3728. .LP
  3729. 3.5
  3730.     \fBidentifier octets\fR 
  3731. .sp 9p
  3732. .RT
  3733. .PP
  3734. Part of a data value encoding which is used to identify the type of the 
  3735. value. 
  3736. .RT
  3737. .sp 1P
  3738. .LP
  3739. 3.6
  3740.     \fBlength octets\fR 
  3741. .sp 9p
  3742. .RT
  3743. .PP
  3744. Part of a data value encoding following the identifier octets
  3745. which is used to determine the end of the encoding.
  3746. .RT
  3747. .sp 1P
  3748. .LP
  3749. 3.7
  3750.     \fBend\(hyof\(hycontents octets\fR 
  3751. .sp 9p
  3752. .RT
  3753. .PP
  3754. Part of a data value encoding, occurring at its end, which is used to determine 
  3755. the end of the encoding. 
  3756. .PP
  3757. \fINote\fR \ \(em\ Not all encodings require end\(hyof\(hycontents octets.
  3758. .bp
  3759. .RT
  3760. .sp 1P
  3761. .LP
  3762. 3.8
  3763.     \fBcontents octets\fR 
  3764. .sp 9p
  3765. .RT
  3766. .PP
  3767. That part of a data value encoding which represents a particular value, 
  3768. to distinguish it from other values of the same type. 
  3769. .RT
  3770. .sp 1P
  3771. .LP
  3772. 3.9
  3773.     \fBprimitive encoding\fR 
  3774. .sp 9p
  3775. .RT
  3776. .PP
  3777. A data value encoding in which the contents octets directly
  3778. represent the value.
  3779. .RT
  3780. .sp 1P
  3781. .LP
  3782. 3.10
  3783.     \fBconstructed encoding\fR 
  3784. .sp 9p
  3785. .RT
  3786. .PP
  3787. A data value encoding in which the contents octets are the
  3788. complete encoding of one or more other data values.
  3789. .RT
  3790. .sp 1P
  3791. .LP
  3792. 3.11
  3793.     \fBsender\fR 
  3794. .sp 9p
  3795. .RT
  3796. .PP
  3797. An implementation encoding a data value for transfer.
  3798. .RT
  3799. .sp 1P
  3800. .LP
  3801. 3.12
  3802.     \fBreceiver\fR 
  3803. .sp 9p
  3804. .RT
  3805. .PP
  3806. An implementation decoding the octets produced by a sender, in
  3807. order to identify the datavalue which was encoded.
  3808. .RT
  3809. .sp 2P
  3810. .LP
  3811. \fB4\fR     \fBAbbrevistions and notation\fR 
  3812. .sp 1P
  3813. .RT
  3814. .sp 1P
  3815. .LP
  3816. 4.1
  3817.     \fIAbbreviations\fR 
  3818. .sp 9p
  3819. .RT
  3820. .LP
  3821.     ASN.1
  3822.     Abstract Syntax Notation One
  3823. .sp 2P
  3824. .LP
  3825. 4.2
  3826.     \fINotation\fR 
  3827. .sp 1P
  3828. .RT
  3829. .PP
  3830. 4.2.1 
  3831. This Recommendation references the notation defined by
  3832. Recommendation\ X.208.
  3833. .sp 9p
  3834. .RT
  3835. .PP
  3836. 4.2.2
  3837. This Recommendation specifies the value of each octet in an
  3838. encoding by use of the terms \*Qmost significant bit\*U and \*Qleast significant 
  3839. bit\*U.
  3840. .PP
  3841. \fINote\fR \ \(em\ Lower layer specifications use the same notation to
  3842. define the order of bit transmission on a serial line, or the assignment of
  3843. bits to parallel channels.
  3844. .PP
  3845. 4.2.3 
  3846. For the purposes of this Recommendation, the bits of an octet are numbered 
  3847. from 8 to 1, where bit\ 8 is the \*Qmost significant bit\*U, and bit\ 1 
  3848. is the \*Qleast significant bit\*U. 
  3849. .sp 9p
  3850. .RT
  3851. .sp 2P
  3852. .LP
  3853. \fB5\fR     \fBConformance\fR 
  3854. .sp 1P
  3855. .RT
  3856. .PP
  3857. 5.1
  3858. Dynamic conformance is specified by \(sc\ 6 to \(sc\ 24 inclusive.
  3859. .sp 9p
  3860. .RT
  3861. .PP
  3862. 5.2
  3863. Static conformance is specified by those documents which specify the application 
  3864. of these basic encoding rules. 
  3865. .PP
  3866. 5.3
  3867. Alternative encodings are permitted by this Recommendation as a
  3868. sender's option. Conforming receivers shall support all alternatives.
  3869. .PP
  3870. \fINote\fR \ \(em\ Examples of such alternative encodings appear in
  3871. \(sc\ 6.3.2\|b) and Table\ 2/X.209.
  3872. .sp 2P
  3873. .LP
  3874. \fB6\fR     \fBGeneral rules for encoding\fR 
  3875. .sp 1P
  3876. .RT
  3877. .sp 1P
  3878. .LP
  3879. 6.1
  3880.     \fIStructure of an encoding\fR 
  3881. .sp 9p
  3882. .RT
  3883. .PP
  3884. 6.1.1 
  3885. The encoding of a data value shall consist of four components
  3886. which shalll appear in the following order:
  3887. .sp 9p
  3888. .RT
  3889. .LP
  3890.     a)
  3891.     identifier octets (see \(sc\ 6.2);
  3892. .LP
  3893.     b)
  3894.     length octets (see \(sc\ 6.3);
  3895. .LP
  3896.     c)
  3897.     contents octets (see \(sc\ 6.4);
  3898. .LP
  3899.     d)
  3900.     end\(hyof\(hycontents octets (see \(sc\ 6.5).
  3901. .bp
  3902. .PP
  3903. 6.1.2 
  3904. The end\(hyof\(hycontents octets shall not be present unless the value 
  3905. of the length octets requires them to be present (see \(sc\ 6.3). 
  3906. .sp 9p
  3907. .RT
  3908. .PP
  3909. 6.1.3
  3910. Figure 1/X.209 illustrates the structure of an encoding (primitive or constructed). 
  3911. Figure\ 2/X.209 illustrates an alternative constructed 
  3912. encoding.
  3913. .sp 2P
  3914. .LP
  3915. 6.2
  3916.     \fIIdentifier octets\fR 
  3917. .sp 1P
  3918. .RT
  3919. .PP
  3920. 6.2.1 
  3921. The identifier octets shall encode the ASN.1 tag (class and
  3922. number) of the type of the data value.
  3923. .sp 9p
  3924. .RT
  3925. .PP
  3926. 6.2.2
  3927. For tags with a number ranging from zero to 30 (inclusive), the
  3928. identifier octets shall comprise a single octets encoded as follows:
  3929. .LP
  3930.     a)
  3931.     bits 8 and 7 shall be encoded to represent the clas of the
  3932. tag as specified in Table\ 1/X.209;
  3933. .LP
  3934.     b)
  3935.     bit 6 shall be a zero or a one according to the rules of
  3936. \(sc\ 6.2.5;
  3937. .LP
  3938.     c)
  3939.     bit 5 to 1 shall encode the number of the tag as a binary
  3940. integer with bit 5 as the most significant bit.
  3941. .PP
  3942. 6.2.3 
  3943. Figure 3/X.209 illustrates the form of an identifier octet for a type with 
  3944. a tag whose number is in the range zero to 30 (inclusive). 
  3945. .sp 9p
  3946. .RT
  3947. .PP
  3948. 6.2.4
  3949. For tags with a number greater than or equal to 31, the identifier shall 
  3950. comprise a leading octet followed by one or more subsequent octets. 
  3951. .ce
  3952. \fBH.T. [T1.209]\fR 
  3953. .ce
  3954. TABLE\ 1/X.209
  3955. .ce
  3956. \fBEncoding of class of tag\fR 
  3957. .ps 9
  3958. .vs 11
  3959. .nr VS 11
  3960. .nr PS 9
  3961. .TS
  3962. center box;
  3963. cw(72p) | cw(24p) | cw(24p) .
  3964. Class    Bit 8    Bit 7
  3965. _
  3966. .T&
  3967. lw(72p) | cw(24p) | cw(24p) .
  3968. Universal    0    0
  3969. .T&
  3970. lw(72p) | cw(24p) | cw(24p) .
  3971. Application    0    1
  3972. .T&
  3973. lw(72p) | cw(24p) | cw(24p) .
  3974. Context\(hyspecific    1    0
  3975. .T&
  3976. lw(72p) | cw(24p) | cw(24p) .
  3977. Private    1    1
  3978. _
  3979. .TE
  3980. .nr PS 9
  3981. .RT
  3982. .ad r
  3983. \fBTable 1/X.209 [T1.209], p.\fR 
  3984. .sp 1P
  3985. .RT
  3986. .ad b
  3987. .RT
  3988. .PP
  3989. 6.2.4.1
  3990. The leading octet shall be encoded as follows:
  3991. .sp 9p
  3992. .RT
  3993. .LP
  3994.     a)
  3995.     bits 8 and 7 shall be encoded to represent the class of the
  3996. tags as listed in Table\ 1/X.209;
  3997. .LP
  3998.     b)
  3999.     bit 6 shall be a zero or a one according to the rule of
  4000. \(sc\ 6.2.5;
  4001. .LP
  4002.     c)
  4003.     bit 5 to 1 shall be encoded as 11111\d2\u.
  4004. .LP
  4005. .rs
  4006. .sp 14P
  4007. .ad r
  4008. \fBFigure 1/X.209, p.\fR 
  4009. .sp 1P
  4010. .RT
  4011. .ad b
  4012. .RT
  4013. .LP
  4014. .bp
  4015. .LP
  4016. .rs
  4017. .sp 14P
  4018. .ad r
  4019. \fBFigure 2/X.209, p.\fR 
  4020. .sp 1P
  4021. .RT
  4022. .ad b
  4023. .RT
  4024. .PP
  4025. 6.2.4.2
  4026. The subsequent octets shall encode the number of the tag as
  4027. follows:
  4028. .LP
  4029.     a)
  4030.     bit 8 of each octet shall be set to one unless it is the
  4031. last octet of the identifier octets;
  4032. .LP
  4033.     b)
  4034.     bit 7 to 1 of the first subsequent octet, followed by bits\ 7
  4035. to 1 of the second subsequent octet, followed in turn by bits\ 7 to\ 1
  4036. of each further octet, up to and including the last subsequent octet
  4037. in the identifier octets shall be the encoding of an unsigned binary
  4038. integer equal to the tag number, with bit\ 7 of the first subsequent
  4039. octet as the most significant bit;
  4040. .LP
  4041.     c)
  4042.     bits 7 to 1 of the first subsequent octet shall not all be
  4043. zero.
  4044. .PP
  4045. 6.2.4.3
  4046. Figure 4/X.209 illustrates the form of the identifier octets for a type 
  4047. with a tag whose number is greater than\ 30. 
  4048. .sp 9p
  4049. .RT
  4050. .PP
  4051. 6.2.5
  4052. Bit 6 shall be set to zero if the encoding is primitive, and shall be set 
  4053. to one if the encoding is constructed. 
  4054. .PP
  4055. \fINote\fR \ \(em\ Subsequent clauses specify whether the encoding is
  4056. primitive or constructed for each type.
  4057. .LP
  4058. .rs
  4059. .sp 14P
  4060. .ad r
  4061. \fBFigure 3/X.209, p.\fR 
  4062. .sp 1P
  4063. .RT
  4064. .ad b
  4065. .RT
  4066. .LP
  4067. .bp
  4068. .LP
  4069. .rs
  4070. .sp 14P
  4071. .ad r
  4072. \fBFigure 4/X.209, p.\fR 
  4073. .sp 1P
  4074. .RT
  4075. .ad b
  4076. .RT
  4077. .PP
  4078. 6.2.6 
  4079. Recommendation X.208 specifies that the tag of a type defined
  4080. using the \*QCHOICE\*U keyword takes the value of the tag of the type from 
  4081. which 
  4082. the chosen data value is taken.
  4083. .sp 9p
  4084. .RT
  4085. .PP
  4086. 6.2.7
  4087. Recommendation X.208 specifies that the tag of a type defined
  4088. using \*QANY\*U is indeterminate. The \*QANY\*U type is subsequently defined 
  4089. to be an ASN.1 type, and the complete encoding is then identical to that 
  4090. of a value of the assigned type (including the identifier octets). 
  4091. .sp 2P
  4092. .LP
  4093. 6.3
  4094.     \fILength octets\fR 
  4095. .sp 1P
  4096. .RT
  4097. .PP
  4098. 6.3.1 
  4099. Two forms of length octets specified. These are
  4100. .sp 9p
  4101. .RT
  4102. .LP
  4103.     a)
  4104.     the definite form (see \(sc 6.3.3); and
  4105. .LP
  4106.     b)
  4107.     the indefinite form (see \(sc\ 6.3.4).
  4108. .PP
  4109. 6.3.2 
  4110. A sender shall
  4111. .sp 9p
  4112. .RT
  4113. .LP
  4114.     a)
  4115.     use the definite form (\(sc 6.3.3) if the encoding is
  4116. primitive;
  4117. .LP
  4118.     b)
  4119.     use either the definite form (\(sc 6.3.3) or the indefinite
  4120. form (\(sc 6.3.4), a sender's option, if the encoding is constructed and
  4121. all immediately available;
  4122. .LP
  4123.     c)
  4124.     use the indefinite form (\(sc\ 6.3.4) if the encoding is
  4125. constructed and is not all immediately available.
  4126. .PP
  4127. 6.3.3 
  4128. For the definite form, the length octets shall consist of one or more octets, 
  4129. and shall represent the number of octets in the contents octets 
  4130. using either the short form (\(sc\ 6.3.3.1) or the long form (\(sc\ 6.3.3.2) 
  4131. as a 
  4132. sender's option.
  4133. .sp 9p
  4134. .RT
  4135. .PP
  4136. \fINote\fR \ \(em\ The short form can only be used if the number of octets 
  4137. in the contents octets is less than or equal to\ 127. 
  4138. .PP
  4139. 6.3.3.1 
  4140. In the short form, the length octets shall consist of a single octet in 
  4141. which bit 8 is zero and bit\ 7 to\ 1 encode the number of octets in the 
  4142. contents octets (which may be zero), as an unsigned binary integer with 
  4143. bit\ 7 as the most significant bit. 
  4144. .sp 9p
  4145. .RT
  4146. .LP
  4147.     \fIExample:\fR 
  4148. .LP
  4149.     L\ =\ 38 can be encoded as 00100110\d2\u
  4150. .PP
  4151. 6.3.3.2
  4152. In the long form, the length octets shall consist of an initial octet and 
  4153. one or more subsequent octets. The initial octet shall be encoded as follows: 
  4154. .sp 9p
  4155. .RT
  4156. .LP
  4157.     a)
  4158.     bit 8 shall be one;
  4159. .LP
  4160.     b)
  4161.     bits 7 to 1 shall encode the number of subsequent octets
  4162. in the length octets, as an unsigned binary integer with bit\ 7 as the
  4163. most significant bit;
  4164. .LP
  4165.     c)
  4166.     the value 11111111\d2\ushall not be used
  4167. .PP
  4168. \fINote\fR \ \(em\ This restriction is introduced for possible future
  4169. extension.
  4170. .bp
  4171. .PP
  4172. Bits 8 to 1 of the first subsequent octet, followed by bits 8 to 1 of the 
  4173. second subsequent octet, followed in turn by bits\ 8 to\ 1 of each further 
  4174. octet up to and including the last subsequent octet, shall be the encoding 
  4175. of an unsigned binary integer equal to the number of octets in the contents 
  4176. octets, with bit\ 8 of the first subsequent octet as the most significant
  4177. bit.
  4178. .RT
  4179. .LP
  4180.     \fIExample:\fR 
  4181. .LP
  4182.     L\ =\ 201 can be encoded as:\ 10000001\d2\u
  4183. .LP
  4184. L\ =\ 201 can be encoded as:
  4185. \ 11001001\d2\u
  4186. .PP
  4187. \fINote\fR \ \(em\ In the long form, it is a sender's option whether to 
  4188. use more length octets than the minimum necessary. 
  4189. .PP
  4190. 6.3.4 
  4191. For the indefinite form, the length octets indicate that the
  4192. contents are terminated by end\(hyof\(hycontents octets (see \(sc\ 6.5), 
  4193. and shall 
  4194. consist of a single octet.
  4195. .sp 9p
  4196. .RT
  4197. .PP
  4198. 6.3.4.1
  4199. The single octet shall have bit 8 set to one, and bits 7 to\ 1 set  to zero.
  4200. .PP
  4201. 6.3.4.2
  4202. If this form of length is used, then end\(hyof\(hycontents octets (see 
  4203. \(sc\ 6.5) shall be present in the encoding following the contents octets. 
  4204. .sp 1P
  4205. .LP
  4206. 6.4
  4207.     \fIContents octets\fR 
  4208. .sp 9p
  4209. .RT
  4210. .PP
  4211. The contents octets shall consist of zero, one or more octets, and shall 
  4212. encode the data value as specified in subsequent clauses. 
  4213. .PP
  4214. \fINote\fR \ \(em\ The contents octets depend on the type of the data value;
  4215. subsequent clauses follow the same sequence as the definition of types in
  4216. ASN.1.
  4217. .RT
  4218. .sp 1P
  4219. .LP
  4220. 6.5
  4221.     \fIEnd\(hyof\(hycontents octets\fR 
  4222. .sp 9p
  4223. .RT
  4224. .PP
  4225. The end\(hyof\(hycontents octets shall be present if the length is
  4226. encoded as specified in \(sc\ 6.3.4, otherwise they shall not be present.
  4227. .PP
  4228. The end\(hyof\(hycontents octets shall consist of two zero octets.
  4229. .PP
  4230. \fINote\fR \ \(em\ The end\(hyof\(hycontents octets can be considered as 
  4231. the encoding of a value whose tag is universal, whose form is primitive, 
  4232. whose number of the tag is zero, and whose contents is absent, thus: 
  4233. .RT
  4234. .LP
  4235.     End\(hyof\(hycontents
  4236.     Length
  4237.     Contents
  4238. .LP
  4239.     00\d1\\d6\u    00\d1\\d6\u    Absent
  4240. .sp 2P
  4241. .LP
  4242. \fB7\fR     \fBEncoding of a Boolean value\fR 
  4243. .sp 1P
  4244. .RT
  4245. .PP
  4246. 7.1
  4247. The encoding of a Boolean value shall be primitive. The contents octets 
  4248. shall consist of a single octet. 
  4249. .sp 9p
  4250. .RT
  4251. .PP
  4252. 7.2
  4253. If the Boolean value is
  4254. .sp 1P
  4255. .ce 1000
  4256. FALSE
  4257. .ce 0
  4258. .sp 1P
  4259. .LP
  4260. the octet shall be zero.
  4261. .PP
  4262. 7.2.1 
  4263. If the Boolean value is
  4264. .sp 9p
  4265. .RT
  4266. .sp 1P
  4267. .ce 1000
  4268. TRUE
  4269. .ce 0
  4270. .sp 1P
  4271. .LP
  4272. the octet shall have any non\(hyzero value, as a sender's option.
  4273. .LP
  4274.     \fIExample\fR \ \(em\ If of type BOOLEAN, the value TRUE can be encoded as:
  4275. .LP
  4276.     Boolean
  4277.     Length
  4278.     Contents
  4279. .LP
  4280.     01\d1\\d6\u    01\d1\\d6\u
  4281.     FF\d1\\d6\u
  4282. .sp 2P
  4283. .LP
  4284. \fB8\fR     \fBEncoding of an integer value\fR 
  4285. .sp 1P
  4286. .RT
  4287. .PP
  4288. 8.1
  4289. The encoding of an integer value shall be primitive. The contents octets 
  4290. shall consist of one or more octets. 
  4291. .bp
  4292. .sp 9p
  4293. .RT
  4294. .PP
  4295. 8.2
  4296. If the contents octets of an integer value encoding consist of
  4297. more than one octet, then the bits of the first octet and bit\ 8 of the 
  4298. second octet 
  4299. .LP
  4300.     a)
  4301.     shall not all be ones; and
  4302. .LP
  4303.     b)
  4304.     shall not all be zero.
  4305. .PP
  4306. \fINote\fR \ \(em\ These rules ensure that an integer value is always
  4307. encoded in the smallest possible number of octets.
  4308. .PP
  4309. 8.3
  4310. The contents octets shall be a two's complement binary number
  4311. equal to the integer value, and consisting of bits\ 8 to\ 1 of the first 
  4312. octet, followed by bits\ 8 to\ 1 of the second octet, followed by bits\ 
  4313. 8 to\ 1 of each 
  4314. octet in turn up to and including the last octet of the contents octets.
  4315. .sp 9p
  4316. .RT
  4317. .PP
  4318. \fINote\fR \ \(em\ The value of a two's complement binary number is derived 
  4319. by numbering the bits in the contents octets, starting with bit\ 1 of the 
  4320. last octet as bit zero and ending the numbering with bit\ 8 of the first 
  4321. octet. Each bit is assigned a numerical value of 2\uN\d, where N is its 
  4322. position in the 
  4323. above numbering sequence. The value of the two's complement binary number is
  4324. obtained by summing the numerical values assigned to each bit for those bits
  4325. which are set to one, excluding bit\ 8 of the first octet, and then reducing
  4326. this value by the numerical value assigned to bit\ 8 of the first octet 
  4327. if that bit is set to one. 
  4328. .sp 2P
  4329. .LP
  4330. \fB9\fR     \fBEncoding of an enumerated value\fR 
  4331. .sp 1P
  4332. .RT
  4333. .PP
  4334. 9.1
  4335. The encoding of an enumerated value shall be that of the integer value 
  4336. with which it is associated. 
  4337. .sp 9p
  4338. .RT
  4339. .sp 2P
  4340. .LP
  4341. \fB10\fR     \fBEncoding of a real value\fR 
  4342. .sp 1P
  4343. .RT
  4344. .PP
  4345. 10.1
  4346. The encoding of a real value shall be primitive.
  4347. .sp 9p
  4348. .RT
  4349. .PP
  4350. 10.2
  4351. If the real value is the value zero, there shall be no contents
  4352. octets in the encoding.
  4353. .PP
  4354. 10.3
  4355. If the real value is non\(hyzero, then the base used for the encoding shall 
  4356. be B', chosen by the sender. If B' is 2, 8 or\ 16, a 
  4357. binary encoding, specified in \(sc\ 10.5, shall be used. If B' is\ 10, a
  4358. character encoding, specified in \(sc\ 10.6, shall be used.
  4359. .PP
  4360. \fINote\fR \ \(em\ The form of storage, generation, or processing by senders 
  4361. and receivers, and the form used in the ASN.1 value notation are all 
  4362. independent of the base used for transfer.
  4363. .PP
  4364. 10.4
  4365. Bit 8 of the first contents octet shall be set as follows:
  4366. .sp 9p
  4367. .RT
  4368. .LP
  4369.     a)
  4370.     if bit 8 = 1, then the binary encoding specified in \(sc\ 10.5   applies;
  4371. .LP
  4372.     b)
  4373.     if bit 8 = 0 and bit 7 = 0, then the decimal encoding
  4374. specified in \(sc\ 10.6 applies;
  4375. .LP
  4376.     c)
  4377.      if bit 8 = 0 and bit 7 = 1, then a \*QSpecialRealValue\*U (see Recommendation\ 
  4378. X.208) is encoded as specified in \(sc\ 10.7. 
  4379. .PP
  4380. 10.5
  4381. When binary encoding is used (bit 8 = 1), then if the mantissa, M is non\(hyzero, 
  4382. it shall be represented by a sign\ S, a non\(hynegative integer 
  4383. value\ N and a binary scaling factor\ F, such that
  4384. \v'6p'
  4385. .sp 9p
  4386. .RT
  4387. .sp 1P
  4388. .ce 1000
  4389. M = S X N X 2\uF\d, 0 \(= F < 4, S = +1 or \(em1
  4390. .ce 0
  4391. .sp 1P
  4392. .PP
  4393. .sp 1
  4394. \fINote\fR \ \(em\ This freedom to choose F is provided to enable easier
  4395. generation of the transfer format by eliminating the need to align the 
  4396. implied decimal point of the mantissa with an octet boundary (see Appendix\ 
  4397. III). The 
  4398. existence of F does not noticeably complicate the task of receivers.
  4399. .PP
  4400. 10.5.1
  4401. Bit 7 of the first contents octets shall be 1 if S is \(em1 and 0
  4402. otherwise.
  4403. .bp
  4404. .sp 9p
  4405. .RT
  4406. .PP
  4407. 10.5.2
  4408. Bits 6 to 5 of the first contents octets shall encode the value of the 
  4409. base B' as follows: 
  4410. .ce
  4411. \fBH.T. [T2.209]\fR 
  4412. .ps 9
  4413. .vs 11
  4414. .nr VS 11
  4415. .nr PS 9
  4416. .TS
  4417. center box;
  4418. cw(30p) | cw(60p) .
  4419. Bits 6 to 5    Base
  4420. _
  4421. .T&
  4422. cw(30p) | lw(60p) .
  4423. 00    base 2 
  4424. .T&
  4425. cw(30p) | lw(60p) .
  4426. 01    base 8 
  4427. .T&
  4428. cw(30p) | lw(60p) .
  4429. 10    base 16 
  4430. .T&
  4431. cw(30p) | lw(60p) .
  4432. 11    T{
  4433. Reserved for future versions of this
  4434. Recommendation
  4435. T}
  4436. _
  4437. .TE
  4438. .nr PS 9
  4439. .RT
  4440. .ad r
  4441. \fBTable [T2.209], p.\fR 
  4442. .sp 1P
  4443. .RT
  4444. .ad b
  4445. .RT
  4446. .PP
  4447. 10.5.3
  4448. Bits 4 to 3 of the first contents octet shall encode the value of the binary 
  4449. scaling factor F as an unsigned binary integer. 
  4450. .PP
  4451. 10.5.4
  4452. Bits 2 to 1 of the first contents octet shall encode the format of the 
  4453. exponent as follows: 
  4454. .LP
  4455.     a)
  4456.     if bits 2 to 1 are 00, then the second contents octet
  4457. encodes the value of the exponent as a two's complement binary
  4458. number;
  4459. .LP
  4460.     b)
  4461.     if bits 2 to 1 are 01, then the second and third contents
  4462. octets encode the value of the exponents as a two's complement binary
  4463. number;
  4464. .LP
  4465.     c)
  4466.     if bits 2 to 1 are 10, then the second, third and fourth
  4467. contents octets encode the value of the exponent as a two's complement
  4468. binary number;
  4469. .LP
  4470.     d)
  4471.     if bits 2 to 1 are 11, then the second contents octet
  4472. encodes the number of octets, X say, (as an unsigned binary number)
  4473. used to encode the value of the exponent, and the third up to the
  4474. (X\ plus\ 3)\ut\d\uh\d (inclusive) contents octets encode the value of
  4475. the exponent as a two's complement binary number; the value of
  4476. X\ shall be at least one; the first nine bits of the transmitted
  4477. exponent shall not be all zeros or all ones.
  4478. .PP
  4479. 10.5.5
  4480. The remaining contents octets encode the value of the integer N
  4481. (see \(sc\ 10.5) as an unsigned binary number.
  4482. .sp 9p
  4483. .RT
  4484. .PP
  4485. \fINote\ 1\fR \ \(em\ This encoding does not specify a \*Qnormalized\*U
  4486. representation, there being a number of possible representations of each 
  4487. value (except zero). This variation is a senders option, and can be used 
  4488. as a broad indication of precision. 
  4489. .PP
  4490. \fINote\ 2\fR \ \(em\ This representation of real numbers is very different 
  4491. from the formats normally used in floating point hardware, but has been 
  4492. designed to be easily converted to and from such formats (see Appendix\ 
  4493. III). 
  4494. .RT
  4495. .PP
  4496. 10.6
  4497. When decimal encoding is used (bits 8 to 7 = 00), all the contents octets 
  4498. following the first contents octet form a field, as the term is used in 
  4499. ISO\ 6093, of a length chosen by the sender, and encoded according to ISO\ 
  4500. 6093. The choice of ISO 6093 number representation is specified by bits\ 
  4501. 6 to\ 1 of the first contents octet as follows: 
  4502. .sp 9p
  4503. .RT
  4504. .ce
  4505. \fBH.T. [T3.209]\fR 
  4506. .ps 9
  4507. .vs 11
  4508. .nr VS 11
  4509. .nr PS 9
  4510. .TS
  4511. center box;
  4512. cw(30p) | cw(60p) .
  4513. Bits 6 to 1    Number representation
  4514. _
  4515. .T&
  4516. cw(30p) | lw(60p) .
  4517. 00 0001    ISO 6093 NR1 form 
  4518. .T&
  4519. cw(30p) | lw(60p) .
  4520. 00 0010    ISO 6093 NR2 form 
  4521. .T&
  4522. cw(30p) | lw(60p) .
  4523. 00 0011    ISO 6093 NR3 form 
  4524. _
  4525. .TE
  4526. .nr PS 9
  4527. .RT
  4528. .ad r
  4529. \fBTable [T3.209], p.\fR 
  4530. .sp 1P
  4531. .RT
  4532. .ad b
  4533. .RT
  4534. .PP
  4535. The remaining values of bits 6 to 1 are reserved for future
  4536. versions of this Recommendation.
  4537. .PP
  4538. \fINote\ 1\fR \ \(em\ The Recommendation in ISO 6093 concerning the user of at
  4539. least one digit to the left of the decimal mark are also recommended in this
  4540. Recommendation, but are not mandatory.
  4541. .PP
  4542. \fINote\ 2\fR \ \(em\ There shall be no use of scaling factors specified in
  4543. accompanying documentation (see ISO\ 6093).
  4544. .PP
  4545. \fINote\ 3\fR \ \(em\ Use of the normalised form (see ISO 6093) is a senders
  4546. option, and has no significance.
  4547. .bp
  4548. .RT
  4549. .PP
  4550. 10.7
  4551. When \*QSpecialRealValues\*U are to be encoded (bits 8 to 7 = 01),
  4552. there shall be only one contents octet, with values as follows:
  4553. .sp 9p
  4554. .RT
  4555. .LP
  4556.     01000000\ \ \ Value is PLUS\(hyINFINITY
  4557. .LP
  4558. 01000001\ \ \ Value is MINUS\(hyINFINITY
  4559. .PP
  4560. All other values having bit 8 and 7 equal to 0 and 1 respectively are reserved 
  4561. for future versions of this Recommendation. 
  4562. .sp 2P
  4563. .LP
  4564. \fB11\fR     \fBEncoding of a bitstring value\fR 
  4565. .sp 1P
  4566. .RT
  4567. .PP
  4568. 11.1
  4569. The encoding of a bitstring value shall be either primitive or
  4570. constructed at the option of the sender.
  4571. .sp 9p
  4572. .RT
  4573. .PP
  4574. \fINote\fR \ \(em\ Where it is necessary to transfer part of a bit string
  4575. before the entire bitstring is available, the constructed encoding is used.
  4576. .PP
  4577. 11.2
  4578. The contents octets for the primitive encoding shall contain an
  4579. initial octet followed by zero, one or more subsequent octets.
  4580. .sp 9p
  4581. .RT
  4582. .PP
  4583. 11.2.1
  4584. The bits in the bitstring, commencing with the first bit and
  4585. proceeding to the trailing bit, shall be placed in bits\ 8 to\ 1 of the first
  4586. subsequent octet, followed by bits\ 8 to\ 1 of the second subsequent octet,
  4587. followed by bits\ 8 to\ 1 of each octet in turn, followed by as many bits 
  4588. as are needed of the final subsequent octet, commencing with bit\ 8. 
  4589. .PP
  4590. \fINote\fR \ \(em\ The notation \*Qfirst bit\*U and \*Qtrailing bit\*U 
  4591. is specified in Recommendation\ X.208. 
  4592. .PP
  4593. 11.2.2
  4594. The initial octet shall encode, as an unsigned binary integer with bit\ 
  4595. 1 as the least significant bit, the number of unused bits in the final 
  4596. subsequent octet. The number shall be in the range zero to seven.
  4597. .sp 9p
  4598. .RT
  4599. .PP
  4600. 11.2.3
  4601. If the bitstring is empty, there shall be no subsequent octets,
  4602. and the initial octet shall be zero.
  4603. .PP
  4604. 11.3
  4605. The contents octets for the constructed encoding shall consist of the complete 
  4606. encoding of zero, one or more data values. 
  4607. .PP
  4608. \fINote\fR \ \(em\ Each such encoding includes identifier, length, and
  4609. contents octets, and may include end\(hyof\(hycontents octets if it is 
  4610. constructed. 
  4611. .PP
  4612. 11.3.1
  4613. Each data value encoding in the contents octets shall be the
  4614. encoding of a value of type BIT STRING.
  4615. .sp 9p
  4616. .RT
  4617. .PP
  4618. \fINote\fR \ \(em\ In particular, the tags in the contents octets are always 
  4619. universal class, number\ 3. 
  4620. .PP
  4621. 11.3.2
  4622. The bits in the bitstring value being encoded, commencing with the first 
  4623. bit and proceeding to the trailing bit, shall be placed in the first bit 
  4624. up to the trailing bit of the first data value encoded in the contents 
  4625. octets, followed by the first bit up to the trailing bit of the second 
  4626. data value 
  4627. encoded in the contents octets, followed by the first bit up to the trailing
  4628. bit of each data value in turn, followed by the first bit up to the trailing
  4629. bit of the last data value encoded in the contents octets.
  4630. .sp 9p
  4631. .RT
  4632. .PP
  4633. 11.3.3
  4634. Each data value encoded in the contents octets, with the exception of the 
  4635. last, shall consist of a number of bits which is a multiple of eight. 
  4636. .PP
  4637. \fINote\fR \ \(em\ A data value encoded in the contents octets may be a
  4638. zero\(hylength bitstring.
  4639. .PP
  4640. 11.3.4
  4641. Where a constructed encoding is used, there shall be no
  4642. significance placed on the boundary between the data values encoded in the
  4643. contents octets.
  4644. .sp 9p
  4645. .RT
  4646. .PP
  4647. 11.3.5
  4648. The encoding of each data value encoded in the contents octets may be primitive 
  4649. or constructed. 
  4650. .PP
  4651. \fINote\fR \ \(em\ It is usually primitive.
  4652. .PP
  4653. \fIExample\fR \ \(em\ If of type BIT STRING, the value '0A3B5F291CD'H can be
  4654. encoded as shown below. In this example, the Bit String is represented as a
  4655. primitive:
  4656. .RT
  4657. .LP
  4658.     BitString
  4659.     Length
  4660.     Contents
  4661. .LP
  4662.     03\d1\\d6\u    07\d1\\d6\u    040A3B5F291CD0\d1\\d6\u.bp
  4663. .PP
  4664. The value shown above can also be encoded as shown below. In this example, 
  4665. the Bit String is represented as a constructor: 
  4666. .ce
  4667. \fBH.T. [T5.209]\fR 
  4668. .ps 9
  4669. .vs 11
  4670. .nr VS 11
  4671. .nr PS 9
  4672. .TS
  4673. center box;
  4674. lw(30p) | lw(24p) | lw(30p) .
  4675. BitString    \fILength\fR    \fIContents\fR  
  4676. .T&
  4677. lw(30p) | lw(24p) | lw(30p) .
  4678. 23 1 6    80 1 6    
  4679. .T&
  4680. lw(30p) | lw(24p) | lw(30p) .
  4681. BitString    \fILength\fR    \fIContents\fR  
  4682. .T&
  4683. lw(30p) | lw(24p) | lw(30p) .
  4684. 03 1 6    03 1 6    000A3B 1 6
  4685. .T&
  4686. lw(30p) | lw(24p) | lw(30p) .
  4687. BitString    \fILength\fR    \fIContents\fR  
  4688. .T&
  4689. lw(30p) | lw(24p) | lw(30p) .
  4690. 03 1 6    05 1 6    045F291CD0 1 6
  4691. .T&
  4692. lw(30p) | lw(24p) | lw(30p) .
  4693. EOC    \fILength\fR    
  4694. .T&
  4695. lw(30p) | lw(24p) | lw(30p) .
  4696. 00 1 6    00 1 6    
  4697. .TE
  4698. .nr PS 9
  4699. .RT
  4700. .ad r
  4701. \fBTable [T5.209], p.\fR 
  4702. .sp 1P
  4703. .RT
  4704. .ad b
  4705. .RT
  4706. .sp 2P
  4707. .LP
  4708. \fB12\fR     \fBEncoding of an octetstring value\fR 
  4709. .sp 1P
  4710. .RT
  4711. .PP
  4712. 12.1
  4713. The encoding of an octetstring value shall be either primitive or constructed 
  4714. at the option of the sender. 
  4715. .sp 9p
  4716. .RT
  4717. .PP
  4718. \fINote\fR \ \(em\ Where it is necessary to transfer part of an octet string 
  4719. before the entire octetstring is available, the constructed encoding is 
  4720. used. 
  4721. .PP
  4722. 12.2
  4723. The primitive encoding contains zero, one or more contents octets equal 
  4724. in value to the octets in the data value, in the order they appear in the 
  4725. data value, and with the most significant bit of an octet of the data value 
  4726. aligned with the most significant bit of an octet of the contents octets.
  4727. .sp 9p
  4728. .RT
  4729. .PP
  4730. 12.3
  4731. The contents octets for the constructed encoding shall consist of the complete 
  4732. encoding of zero, one or more data values. 
  4733. .PP
  4734. \fINote\fR \ \(em\ Each such encoding includes identifier, length, and
  4735. contents octets, and may include end\(hyof\(hycontents octets if it is 
  4736. constructed. 
  4737. .PP
  4738. 12.3.1
  4739. Each data value encoding in the contents octets shall be the
  4740. encoding of a value of type octetstring.
  4741. .sp 9p
  4742. .RT
  4743. .PP
  4744. \fINote\fR \ \(em\ In particular, the tags in the contents octets are always 
  4745. universal class, number\ 4. 
  4746. .PP
  4747. 12.3.2
  4748. The octets in the octetstring value being encoded, commencing with the 
  4749. first octet and proceeding to the trailing octet, shall be placed in the 
  4750. first up to the trailing octet of the first data value encoded in the contents 
  4751. octets, followed by the first up to the trailing octet of the second data 
  4752. value encoded in the contents octets, followed by the first up to the trailing 
  4753. octet of each data value in turn, followed by the first up to the trailing 
  4754. octet of the last data value encoded in the contents octets. 
  4755. .sp 9p
  4756. .RT
  4757. .PP
  4758. \fINote\fR \ \(em\ A data value encoded in the contents octets may be a 
  4759. zero length octet string. 
  4760. .PP
  4761. 12.3.3
  4762. Where a constructed encoding is used, there shall be no
  4763. significance placed on the boundary between the data values encoded in the
  4764. contents octets.
  4765. .sp 9p
  4766. .RT
  4767. .PP
  4768. 12.3.4
  4769. The encoding of each data value encoded in the contents octets may be primitive 
  4770. or constructed. 
  4771. .PP
  4772. \fINote\fR \ \(em\ It is usually primitive.
  4773. .sp 2P
  4774. .LP
  4775. \fB13\fR     \fBEncoding of a null value\fR 
  4776. .sp 1P
  4777. .RT
  4778. .PP
  4779. 13.1
  4780. The encoding of a null value shall be primitive.
  4781. .sp 9p
  4782. .RT
  4783. .PP
  4784. 13.2
  4785. The contents octets shall not contain any octets.
  4786. .PP
  4787. \fINote\fR \ \(em\ The length octet is zero.
  4788. .LP
  4789.     \fIExample\fR \ \(em\ If of type NULL, the NULL can be encoded as:
  4790. .ce
  4791. \fBH.T. [T6.209]\fR 
  4792. .ps 9
  4793. .vs 11
  4794. .nr VS 11
  4795. .nr PS 9
  4796. .TS
  4797. center box;
  4798. lw(24p) | lw(36p) .
  4799. Null    \fILength\fR
  4800. .T&
  4801. lw(24p) | lw(36p) .
  4802. 05 1 6    00 1 6
  4803. .TE
  4804. .nr PS 9
  4805. .RT
  4806. .ad r
  4807. \fBTable [T6.209], p.\fR 
  4808. .sp 1P
  4809. .RT
  4810. .ad b
  4811. .RT
  4812. .LP
  4813. .bp
  4814. .sp 2P
  4815. .LP
  4816. \fB14\fR     \fBEncoding of a sequence value\fR 
  4817. .sp 1P
  4818. .RT
  4819. .PP
  4820. 14.1
  4821. The encoding of a sequence value shall be constructed.
  4822. .sp 9p
  4823. .RT
  4824. .PP
  4825. 14.2
  4826. The contents octets shall consist of the complete encoding of one data 
  4827. value from each of the types listed in the ASN.1 definition of the 
  4828. sequence type, in the order of their appearance in the definition, unless 
  4829. the type was referenced with the keyword \*QOPTIONAL\*U or the keyword 
  4830. \*QDEFAULT\*U. 
  4831. .PP
  4832. 14.3
  4833. The encoding of a data value may, but need not, be present for a type which 
  4834. was referenced with the keyword \*QOPTIONAL\*U or the keyword \*QDEFAULT\*U. 
  4835. If present, it shall appear in the encoding at the point corresponding 
  4836. to the appearance of the type in the ASN.1 definition. 
  4837. .LP
  4838.     \fIExample\fR \ \(em\ If of type
  4839. .LP
  4840.     SEQUENCE {name IA5String, ok BOOLEAN}
  4841. .LP
  4842.     the value
  4843. .LP
  4844.     {name \*QSmith\*U, ok TRUE}
  4845. .LP
  4846.     can be encoded as:
  4847. .LP
  4848. .sp 1
  4849. .ce
  4850. \fBH.T. [T7.209]\fR 
  4851. .ps 9
  4852. .vs 11
  4853. .nr VS 11
  4854. .nr PS 9
  4855. .TS
  4856. center box;
  4857. lw(24p) | lw(24p) | lw(24p) .
  4858. Sequence    \fILength\fR    \fIContents\fR  
  4859. .T&
  4860. lw(24p) | lw(24p) | lw(24p) .
  4861. 30 1 6    0A 1 6    
  4862. .T&
  4863. lw(24p) | lw(24p) | lw(30p) .
  4864. IA5String    \fILength\fR    \fIContents\fR  
  4865. .T&
  4866. lw(24p) | lw(24p) | lw(30p) .
  4867. 16 1 6    05 1 6    \*QSmith\*U
  4868. .T&
  4869. lw(24p) | lw(24p) | lw(30p) .
  4870. Boolean    \fILength\fR    \fIContents\fR  
  4871. .T&
  4872. lw(24p) | lw(24p) | lw(30p) .
  4873. 01 1 6    01 1 6    FF 1 6  
  4874. .TE
  4875. .nr PS 9
  4876. .RT
  4877. .ad r
  4878. \fBTable [T7.209], p.\fR 
  4879. .sp 1P
  4880. .RT
  4881. .ad b
  4882. .RT
  4883. .sp 2P
  4884. .LP
  4885. .sp 1
  4886. \fB15\fR     \fBEncoding of a sequence\(hyof value\fR 
  4887. .sp 1P
  4888. .RT
  4889. .PP
  4890. 15.1
  4891. The encoding of a sequence\(hyof value shall be constructed.
  4892. .sp 9p
  4893. .RT
  4894. .PP
  4895. 15.2
  4896. The contents octets shall consist of zero, one or more complete
  4897. encodings of data values from the type listed in the ASN.1 definition.
  4898. .PP
  4899. 15.3
  4900. The order of the encodings of the data values shall be the same as the 
  4901. order of the data values in the sequence\(hyof value to be encoded. 
  4902. .sp 2P
  4903. .LP
  4904. \fB16\fR     \fBEncoding of a set value\fR 
  4905. .sp 1P
  4906. .RT
  4907. .PP
  4908. 16.1
  4909. The encoding of a set value shall be constructed.
  4910. .sp 9p
  4911. .RT
  4912. .PP
  4913. 16.2
  4914. The contents octets shall consist of the complete encoding of a
  4915. data value from each of the types listed in the ASN.1 definition of the set
  4916. type, in an order chosen by the sender, unless the type was referenced 
  4917. with the keyword \*QOPTIONAL\*U or the keyword \*QDEFAULT\*U. 
  4918. .PP
  4919. 16.3
  4920. The encoding of a data value may, but need not, be present for a type which 
  4921. was referenced with the keyword \*QOPTIONAL\*U or the keyword 
  4922. \*QDEFAULT\*U.
  4923. .PP
  4924. \fINote\fR \ \(em\ The order of data values in a set value is not
  4925. significant, and places no constraints on the order during transfer.
  4926. .sp 2P
  4927. .LP
  4928. \fB17\fR     \fBEncoding of a set\(hyof value\fR 
  4929. .sp 1P
  4930. .RT
  4931. .PP
  4932. 17.1
  4933. The encoding of a set\(hyof value shall be constructed.
  4934. .sp 9p
  4935. .RT
  4936. .PP
  4937. 17.2
  4938. The text of \(sc\ 15.2 applies.
  4939. .PP
  4940. 17.3
  4941. The order of data values need not be preserved by the encoding and subsequent 
  4942. decoding. 
  4943. .bp
  4944. .sp 2P
  4945. .LP
  4946. \fB18\fR     \fBEncoding of a choice value\fR 
  4947. .sp 1P
  4948. .RT
  4949. .PP
  4950. The encoding of a choice value shall be the same as the encoding of a value 
  4951. of the chosen type. 
  4952. .PP
  4953. \fINote\ 1\fR \ \(em\ The encoding may be primitive or constructed depending 
  4954. on the chosen type. 
  4955. .PP
  4956. \fINote\ 2\fR \ \(em\ The tag used in the identifier octets is the tag of the
  4957. chosen type, as specified in the ASN.1 definition of the choice type.
  4958. .RT
  4959. .sp 2P
  4960. .LP
  4961. \fB19\fR     \fBEncoding of a selection value\fR 
  4962. .sp 1P
  4963. .RT
  4964. .PP
  4965. The encoding of a selection value shall be the same as the encoding of 
  4966. a value of the selected type. 
  4967. .PP
  4968. \fINote\fR \ \(em\ The encoding may be primitive or constructed depending 
  4969. on the selected type. 
  4970. .RT
  4971. .sp 2P
  4972. .LP
  4973. \fB20\fR     \fBEncoding of a tagged value\fR 
  4974. .sp 1P
  4975. .RT
  4976. .PP
  4977. 20.1
  4978. The encoding of a tagged value shall be derived from the complete encoding 
  4979. of the corresponding data value of the type appearing in the 
  4980. \*QTaggedType\*U notation (called the base encoding) as specified in \(sc\ 
  4981. 20.2 and 
  4982. \(sc\ 20.3.
  4983. .sp 9p
  4984. .RT
  4985. .PP
  4986. 20.2
  4987. If the \*QIMPLICIT\*U keyword was not used in the definition of the
  4988. type, the encoding shall be constructed and the contents octets shall be the
  4989. complete base encoding.
  4990. .PP
  4991. 20.3
  4992. If the \*QIMPLICIT\*U keyword was used in the definition of the type,  then
  4993. .LP
  4994.     a)
  4995.     the encoding shall be constructed if the base encoding is
  4996. constructed, and shall be primitive otherwise; and
  4997. .LP
  4998.     b)
  4999.      the contents octets shall be the same as the contents octets of the base 
  5000. encoding. 
  5001. .LP
  5002.     \fIExample\fR \ \(em\ With ASN.1 type definitions of
  5003. .LP
  5004.     Type1 ::= 
  5005.     VisibleString
  5006. .LP
  5007.     Type2 ::= 
  5008.     [APPLICATION 3] IMPLICIT Type1
  5009. .LP
  5010.     Type3 ::= 
  5011.     [2] Type2
  5012. .LP
  5013.     Type4 ::= 
  5014.     [APPLICATION 7] IMPLICIT Type3
  5015. .LP
  5016.     Type5 ::= 
  5017.     [2] IMPLICIT Type2
  5018. .LP
  5019.     a value of
  5020. .LP
  5021.     \*QJones\*U
  5022. .LP
  5023.     is encoded as follows:
  5024. .ce
  5025. \fBH.T. [T8.209]\fR 
  5026. .ce
  5027. For Type1:
  5028. .ps 9
  5029. .vs 11
  5030. .nr VS 11
  5031. .nr PS 9
  5032. .TS
  5033. center box;
  5034. lw(42p) | lw(30p) | lw(42p) .
  5035. VisibleString    \fILength\fR    \fIContents 
  5036. .T&
  5037. lw(42p) | lw(30p) | lw(42p) .
  5038. 1A 1 6    05 1 6    4A6F6E6573 1 6
  5039. .T&
  5040. lw(174p) .
  5041. For Type2:
  5042. .T&
  5043. lw(42p) | lw(30p) | lw(42p) .
  5044. [Application 3]    \fILength\fR    \fIContents\fR  
  5045. .T&
  5046. lw(42p) | lw(30p) | lw(42p) .
  5047. 43 1 6    05 1 6    4A6F6E6573 1 6
  5048. .T&
  5049. lw(174p) .
  5050. For Type3:
  5051. .T&
  5052. lw(42p) | lw(30p) | lw(42p) .
  5053. [2]    \fILength\fR    \fIContents\fR  
  5054. .T&
  5055. lw(42p) | lw(30p) | lw(42p) .
  5056. A2 1 6    07 1 6    
  5057. .T&
  5058. lw(42p) | lw(30p) | lw(42p) .
  5059. [Application 3]    \fILength\fR    \fIContents\fR  
  5060. .T&
  5061. lw(42p) | lw(30p) | lw(42p) .
  5062. 43 1 6    05 1 6    4A6F6E6573 1 6
  5063. .T&
  5064. lw(174p) .
  5065. For Type4:
  5066. .T&
  5067. lw(42p) | lw(30p) | lw(42p) .
  5068. [Application 7]    \fILength\fR    \fIContents\fR  
  5069. .T&
  5070. lw(42p) | lw(30p) | lw(42p) .
  5071. 67 1 6    07 1 6    
  5072. .T&
  5073. lw(42p) | lw(30p) | lw(42p) .
  5074. [Application 3]    \fILength\fR    \fIContents\fR  
  5075. .T&
  5076. lw(42p) | lw(30p) | lw(42p) .
  5077. 43 1 6    05 1 6    4A6F6E6573 1 6
  5078. .T&
  5079. lw(174p) .
  5080. For Type5:
  5081. .T&
  5082. lw(42p) | lw(30p) | lw(42p) .
  5083. [2]    \fILength\fR    \fIContents\fR  
  5084. .T&
  5085. lw(42p) | lw(30p) | lw(42p) .
  5086. 82 1 6    05 1 6    4A6F6E6573 1 6
  5087. .TE
  5088. .nr PS 9
  5089. .RT
  5090. .ad r
  5091. \fBTable [T8.209], p.\fR 
  5092. .sp 1P
  5093. .RT
  5094. .ad b
  5095. .RT
  5096. .LP
  5097. .bp
  5098. .sp 2P
  5099. .LP
  5100. \fB21\fR     \fBEncoding of a value of the ANY type\fR 
  5101. .sp 1P
  5102. .RT
  5103. .PP
  5104. The encoding of an ANY type shall be the complete encoding
  5105. specified in this Recommendation for the type of the value of the ANY
  5106. type.
  5107. .RT
  5108. .sp 2P
  5109. .LP
  5110. \fB22\fR     \fBEncoding of an object identifier value\fR 
  5111. .sp 1P
  5112. .RT
  5113. .PP
  5114. 22.1
  5115. The encoding of an object identifier value shall be primitive.
  5116. .sp 9p
  5117. .RT
  5118. .PP
  5119. 22.2
  5120. The contents octets shall be an (ordered) list of encoding of
  5121. subidentifiers (see \(sc\ 22.3 and \(sc\ 22.4) concatenated together.
  5122. .PP
  5123. Each subidentifier is represented as a series of (one or more)
  5124. octets. Bit 8 of each octet indicates whether it is the last in the series:
  5125. bit\ 8 of the last octet is zero; bit\ 8 of each preceding octet is one. 
  5126. Bits\ 7\(hy1 of the octets in the series collectively encoded the subidentifier. 
  5127. Conceptually, these groups of bits are concatenated to form an unsigned 
  5128. binary number whose most significant bit is bit\ 7 of the first octet and 
  5129. whose least significant bit is bit\ 1 of the last octet. The subidentifier 
  5130. shall be encoded in the fewest possible octets, that is, the leading octet 
  5131. of the subidentifier shall not have the value\ 80 (hexadecimal). 
  5132. .PP
  5133. 22.3
  5134. The number of subidentifiers (N) shall be one less than
  5135. the number of object identifier components in the object identifier value 
  5136. being encoded. 
  5137. .sp 9p
  5138. .RT
  5139. .PP
  5140. 22.4
  5141. The numerical value of the first subidentifier is derived from the values 
  5142. of the first two object identifier components in the object identifier 
  5143. value being encoded, using the formula 
  5144. \v'6p'
  5145. .sp 1P
  5146. .ce 1000
  5147. (X\|*\|40) + Y
  5148. .ce 0
  5149. .sp 1P
  5150. .LP
  5151. .sp 1
  5152. where X is the value of the first object identifier component
  5153. and Y is the value of the second object identifier component.
  5154. .PP
  5155. \fINote\fR \ \(em\ This packing of the first two object identifier
  5156. components
  5157. recognises that only three values are allocated from the root node, and at
  5158. most\ 39 subsequent values from nodes reached by X\ =\ 0 and X\ =\ 1.
  5159. .PP
  5160. 22.5
  5161. The numerical value of the i'th subidentifier,
  5162. (2\ \(=\ i\ \(=\ N) is that of the (i\ +\ 1)'th object identifier component.
  5163. .sp 9p
  5164. .RT
  5165. .LP
  5166.     \fIExample\fR \ \(em\ An OBJECT IDENTIFIER value of
  5167. .LP
  5168.     {joint\(hyiso\(hyccitt\ 100\ 3}
  5169. .LP
  5170.     which is the same as
  5171. .LP
  5172.     {2\ 100\ 3}
  5173. .LP
  5174.     has a first subidentifier of 180 and a second subidentifier
  5175. of\ 3. The resulting encoding is
  5176. .ce
  5177. \fBH.T. [T9.209]\fR 
  5178. .ps 9
  5179. .vs 11
  5180. .nr VS 11
  5181. .nr PS 9
  5182. .TS
  5183. center box;
  5184. lw(48p) | lw(24p) | lw(36p) .
  5185. OBJECT IDENTIFIER    \fILength\fR    \fIContents\fR
  5186. .T&
  5187. lw(48p) | lw(24p) | lw(36p) .
  5188. 06 1 6    03 1 6    813403 1 6
  5189. .TE
  5190. .nr PS 9
  5191. .RT
  5192. .ad r
  5193. \fBTable [T9.209], p.\fR 
  5194. .sp 1P
  5195. .RT
  5196. .ad b
  5197. .RT
  5198. .sp 2P
  5199. .LP
  5200. \fB23\fR     \fBEncoding for values of the character string types\fR 
  5201. .sp 1P
  5202. .RT
  5203. .PP
  5204. 23.1
  5205. The data value consists of a string of characters from the
  5206. character set specified in the ASN.1 type definition.
  5207. .sp 9p
  5208. .RT
  5209. .PP
  5210. 23.2
  5211. Each data value shall be encoded independently of other data
  5212. values of the same type.
  5213. .PP
  5214. 23.3
  5215. Each character string type shall be encoded as if it had been
  5216. declared
  5217. .sp 1P
  5218. .ce 1000
  5219. [UNIVERSAL x] IMPLICIT OCTET STRING
  5220. .ce 0
  5221. .sp 1P
  5222. .LP
  5223. where x is the number of the universal class tag assigned to the
  5224. character string type in Recommendation\ X.208. The value of the octet 
  5225. string is specified in \(sc\(sc\ 23.4 and\ 23.5. 
  5226. .PP
  5227. 23.4
  5228. Where a character string type is specified in Recommendation X.208 by direct 
  5229. reference to an enumerating table (NumericString and 
  5230. PrintableString), the value of the octet string shall be that specified in
  5231. \(sc\ 23.5 for a VisibleString type with the same character string value.
  5232. .bp
  5233. .sp 9p
  5234. .RT
  5235. .PP
  5236. 23.5
  5237. The octet string shall contain the octets specified in ISO 2022
  5238. for encodings in an 8\(hybit environment, using the escape sequence and 
  5239. character codings registered in accordance with ISO\ 2375. 
  5240. .PP
  5241. 23.5.1
  5242. An escape sequence shall not be used unless it is one of those
  5243. specified by one of the registration numbers used to define the character
  5244. string type in Recommendation\ X.208.
  5245. .ce
  5246. \fBH.T. [T10.209]\fR 
  5247. .ce
  5248. TABLE\ 2/X.209
  5249. .ce
  5250. \fBUse of escape sequences\fR 
  5251. .ps 9
  5252. .vs 11
  5253. .nr VS 11
  5254. .nr PS 9
  5255. .TS
  5256. center box;
  5257. cw(48p) | cw(36p) | cw(36p) | cw(72p) | cw(36p) .
  5258. Type    T{
  5259. Assumed G0 (Registration number)
  5260. T}    T{
  5261. Assumed C0 & C1 (Registration number)
  5262. T}    T{
  5263. Assumed escape sequence(s) and locking shift
  5264. (where applicable)
  5265. T}    T{
  5266. Explicit escape sequences
  5267. allowed?
  5268. T}
  5269. _
  5270. .T&
  5271. lw(48p) | cw(36p) | cw(36p) | lw(72p) | cw(36p) .
  5272. NumericString    2    None    ESC\ 2/8\ 4/0\ LS0    NO
  5273. _
  5274. .T&
  5275. lw(48p) | cw(36p) | cw(36p) | lw(72p) | cw(36p) .
  5276. PrintableString    2    None    ESC\ 2/8\ 4/0\ LS0    NO
  5277. _
  5278. .T&
  5279. lw(48p) | cw(36p) | cw(36p) | lw(72p) | cw(36p) .
  5280. TeletexString (T61String)    102    106(C0) 107(C1)    T{
  5281. ESC\ 2/8\ 7/5\ LS0
  5282. ESC\ 2/1\ 4/5
  5283. ESC\ 2/2\ 4/8
  5284. T}    YES
  5285. _
  5286. .T&
  5287. lw(48p) | cw(36p) | cw(36p) | lw(72p) | cw(36p) .
  5288. VideotexString    102    1(C0) 73(C1)    T{
  5289. ESC\ 2/8\ 7/5\ LS0
  5290. ESC\ 2/1\ 4/0
  5291. ESC\ 2/2\ 4/1
  5292. T}    YES
  5293. _
  5294. .T&
  5295. lw(48p) | cw(36p) | cw(36p) | lw(72p) | cw(36p) .
  5296. VisibleString (ISO646String)    2    None    ESC\ 2/8\ 4/0\ LS0    NO
  5297. _
  5298. .T&
  5299. lw(48p) | cw(36p) | cw(36p) | lw(72p) | cw(36p) .
  5300. IA5String    2    1(C0)    T{
  5301. ESC\ 2/8\ 4/0\ LS0
  5302. ESC\ 2/1\ 4/0
  5303. T}    NO
  5304. _
  5305. .T&
  5306. lw(48p) | cw(36p) | cw(36p) | lw(72p) | cw(36p) .
  5307. GraphicString    2    None    ESC\ 2/8\ 4/0\ LS0    YES
  5308. _
  5309. .T&
  5310. lw(48p) | cw(36p) | cw(36p) | lw(72p) | cw(36p) .
  5311. GeneralString    2    1(C0)    ESC\ 2/8\ 4/0\ LS0 ESC\ 2/1    T{
  5312. YES
  5313. \fINote\fR
  5314. \ \(em\ Many of the commonly used characters (for example, A
  5315. to Z) appear in a number of character repertoires with individual
  5316. registration numbers and escape sequences. Where ASN.1 types allow
  5317. escape sequences, a number of encodings may be possible for a
  5318. particular character string (see also\ \(sc\ 5.3).
  5319. .parag
  5320. T}
  5321. _
  5322. .TE
  5323. .nr PS 9
  5324. .RT
  5325. .ad r
  5326. \fBTable [T10.209], p.\fR 
  5327. .sp 1P
  5328. .RT
  5329. .ad b
  5330. .RT
  5331. .PP
  5332. 23.5.2
  5333. At the start of each string, certain registration numbers shall be assumed 
  5334. to be designated as G0 and/or C0 and/or C1, and invoked (using the 
  5335. terminology of ISO\ 2022). These are specified for each type in Table\ 
  5336. 2/X.209, together with the assumed escape sequence they imply. 
  5337. .PP
  5338. 23.5.3
  5339. Certain character string types shall not contain explicit escape sequences 
  5340. in their encodings; in all other cases, any escape allowed by 
  5341. \(sc\ 23.5.1 can appear at any time, including at the start of the encoding.
  5342. Table\ 2/X.209 lists the types for which explicit escape sequences are allowed.
  5343. .PP
  5344. 23.5.4
  5345. Announcers shall not be used unless explicitly permitted by the
  5346. user of ASN.1.
  5347. .PP
  5348. \fINote\fR \ \(em\ The choice of ASN.1 type provides a limited form of
  5349. announcer functionality. Specific application protocols may choose to carry
  5350. announcers in other protocol elements, or to specify in detail the manner of
  5351. use of announcers.
  5352. .bp
  5353. .LP
  5354.     \fIExample\fR \ \(em\ With the ASN.1 type definition
  5355. .LP
  5356.     Name ::= VisibleString
  5357. .ce
  5358. \fBH.T. [T11.209]\fR 
  5359. .ps 9
  5360. .vs 11
  5361. .nr VS 11
  5362. .nr PS 9
  5363. .TS
  5364. center box;
  5365. lw(168p) .
  5366. a value
  5367. .T&
  5368. lw(168p) .
  5369. \*QJones\*U
  5370. .T&
  5371. lw(168p) .
  5372. T{
  5373. can be encoded (primitive form) as
  5374. T}
  5375. .T&
  5376. lw(42p) | lw(24p) | lw(42p) .
  5377. VisibleString    \fILength\fR    \fIContents\fR  
  5378. .T&
  5379. lw(42p) | lw(24p) | lw(42p) .
  5380. 1A 1 6    05 1 6    4A6F6E6573 1 6
  5381. .T&
  5382. lw(168p) .
  5383. T{
  5384. or (constructor form, definite length), as: 
  5385. T}
  5386. .T&
  5387. lw(42p) | lw(24p) | lw(42p) .
  5388. VisibleString    \fILength\fR    \fIContents\fR  
  5389. .T&
  5390. lw(42p) | lw(24p) | lw(42p) .
  5391. 3A 1 6    09 1 6    
  5392. .T&
  5393. lw(42p) | lw(24p) | lw(42p) .
  5394. OctetString    \fILength\fR    \fIContents\fR  
  5395. .T&
  5396. lw(42p) | lw(24p) | lw(42p) .
  5397. 04 1 6    03 1 6    4A6F6E 1 6
  5398. .T&
  5399. lw(42p) | lw(24p) | lw(42p) .
  5400. OctetString    \fILength\fR    \fIContents\fR  
  5401. .T&
  5402. lw(42p) | lw(24p) | lw(42p) .
  5403. 04 1 6    02 1 6    6573 1 6
  5404. .T&
  5405. lw(168p) .
  5406. T{
  5407. or (constructor form, indefinite length), as: 
  5408. T}
  5409. .T&
  5410. lw(42p) | lw(24p) | lw(42p) .
  5411. VisibleString    \fILength\fR    \fIContents\fR  
  5412. .T&
  5413. lw(42p) | lw(24p) | lw(42p) .
  5414. 3A 1 6    80 1 6    
  5415. .T&
  5416. lw(42p) | lw(24p) | lw(42p) .
  5417. OctetString    \fILength\fR    \fIContents\fR  
  5418. .T&
  5419. lw(42p) | lw(24p) | lw(42p) .
  5420. 04 1 6    03 1 6    4A6F6E 1 6
  5421. .T&
  5422. lw(42p) | lw(24p) | lw(42p) .
  5423. OctetString    \fILength\fR    \fIContents\fR  
  5424. .T&
  5425. lw(42p) | lw(24p) | lw(42p) .
  5426. 04 1 6    02 1 6    6573 1 6
  5427. .T&
  5428. lw(42p) | lw(24p) | lw(42p) .
  5429. EOC    \fILength\fR    
  5430. .T&
  5431. lw(42p) | lw(24p) | lw(42p) .
  5432. 00 1 6    00 1 6    
  5433. .TE
  5434. .nr PS 9
  5435. .RT
  5436. .ad r
  5437. \fBTable [T11.209], p.\fR 
  5438. .sp 1P
  5439. .RT
  5440. .ad b
  5441. .RT
  5442. .PP
  5443. The above example illustrates three of the (many) possible forms available 
  5444. as a sender's option. Receivers are required to handle all permitted forms 
  5445. (see \(sc\ 5.3). 
  5446. .sp 2P
  5447. .LP
  5448. \fB24\fR     \fBEncoding for values of the ASN.1 useful types\fR 
  5449. .sp 1P
  5450. .RT
  5451. .PP
  5452. A definition of these types using ASN.1 is provided in
  5453. Recommendation\ X.208. The encoding shall be that obtained by applying 
  5454. the rules specified in this Recommendation to that type definition. 
  5455. .RT
  5456. .sp 2P
  5457. .LP
  5458. \fB25\fR     \fBUse in transfer syntax definition\fR 
  5459. .sp 1P
  5460. .RT
  5461. .PP
  5462. 25.1
  5463. The encoding rules specified in this Recommendation can be
  5464. referenced and applied whenever there is a need to specify an unambiguous,
  5465. undivided and self\(hydelimiting octet string representation for all of 
  5466. the values of a single ASN.1 type. 
  5467. .sp 9p
  5468. .RT
  5469. .PP
  5470. \fINote\fR \ \(em\ All such octet strings are unambiguous within the scope 
  5471. of the single ASN.1 type. They would not necessarily be unambiguous if 
  5472. mixed 
  5473. with encodings of a different ASN.1 type.
  5474. .PP
  5475. 25.2
  5476. The object identifier and object descriptor values
  5477. .sp 9p
  5478. .RT
  5479. .LP
  5480.     {joint\(hyiso\(hyccitt asn1 (1) basic\(hyencoding\ (1)}
  5481. .LP
  5482.     and
  5483. .LP
  5484.     \*QBasic Encoding of a single ASN.1 type\*U
  5485. .LP
  5486.      are assigned to identify and describe the encoding rules specified in 
  5487. this Recommendation. 
  5488. .PP
  5489. 25.3
  5490. Where an application specification defines an abstract syntax
  5491. as a set of presentation data values, each of which is a value of some
  5492. specifically named ASN.1 type, usually (but not necessarily) a choice type,
  5493. then the object identifier value specified in \(sc\ 25.2 may be used with the
  5494. abstract syntax name to identify that transfer syntax which results from the
  5495. application of the encoding rules specified in this Recommendation to the
  5496. specifically named ASN.1 type used in defining the abstract syntax.
  5497. .sp 9p
  5498. .RT
  5499. .PP
  5500. \fINote\fR \ \(em\ In particular, this identification of the encoding rules 
  5501. can appear in the \*Qtransfer syntax name\*U field of the presentation 
  5502. protocol 
  5503. (Recommendation\ X.226).
  5504. .bp
  5505. .PP
  5506. 25.4
  5507. The name specified in \(sc 25.2 shall not be used with an abstract
  5508. syntax name to identify a transfer syntax if the conditions of \(sc\ 25.3 for
  5509. the definition of the abstract syntax are not met.
  5510. \v'1P'
  5511. .sp 9p
  5512. .RT
  5513. .ce 1000
  5514. APPENDIX\ I
  5515. .ce 0
  5516. .ce 1000
  5517. (to Recommendation X.209)
  5518. .sp 9p
  5519. .RT
  5520. .ce 0
  5521. .ce 1000
  5522. \fBExample of encodings\fR 
  5523. .sp 1P
  5524. .RT
  5525. .ce 0
  5526. .PP
  5527. This appendix illustrates the basic encoding rules specified in
  5528. this Recommendation by showing the representation in octets of a (hypothetical) 
  5529. personnel record which is defined using ASN.1. 
  5530. .sp 1P
  5531. .RT
  5532. .sp 1P
  5533. .LP
  5534. I.1
  5535.     \fIASN.1 description of the record structure\fR 
  5536. .sp 9p
  5537. .RT
  5538. .PP
  5539. The structure of the hypothetical personnel record is formally
  5540. described below using ASN.1 specified in Recommendation\ X.208 for defining
  5541. types.
  5542. .RT
  5543. .LP
  5544.     PersonnelRecord ::= [APPLICATION 0] IMPLICIT SET
  5545. .LP
  5546. {
  5547.     Name,
  5548. .LP
  5549.     \ title
  5550.     [0] VisibleString,
  5551. .LP
  5552.     \ number
  5553.     EmployeeNumber,
  5554. .LP
  5555.     \ dateOfHire
  5556.     [1] Date,
  5557. .LP
  5558.     \ nameOfSpouse
  5559.     [2] Name,
  5560. .LP
  5561.     \ children
  5562.     [3] IMPLICIT
  5563. .LP
  5564. SEQUENCE OF ChildInformation
  5565. .LP
  5566. DEFAULT\ {\|} }
  5567. .LP
  5568.     ChildInformation ::= SET
  5569. .LP
  5570. {
  5571.     Name,
  5572. .LP
  5573.     \ dateOfBirth
  5574.     [0] Date}
  5575. .LP
  5576.     Name ::= [APPLICATION 1] IMPLICIT SEQUENCE
  5577. .LP
  5578.     {givenName
  5579.     VisibleString,
  5580. .LP
  5581.     \ initial
  5582.     VisibleString,
  5583. .LP
  5584.     \ familyName
  5585.     VisibleString}
  5586. .LP
  5587.     EmployeeNumber ::= [APPLICATION 2] IMPLICIT INTEGER
  5588. .LP
  5589.     Date ::= [APPLICATION 3] IMPLICIT VisibleString
  5590. .LP
  5591. \ \(hy\(hy\ YYYYMMDD
  5592. .sp 1P
  5593. .LP
  5594. I.2
  5595.     \fIASN.1 description of a record value\fR 
  5596. .sp 9p
  5597. .RT
  5598. .PP
  5599. The value of John Smith's personnel record is formally described
  5600. below using ASN.1.
  5601. .RT
  5602. .LP
  5603.     {
  5604.     {givenName \*QJohn\*U,initial \*QP\*U,familyName \*QSmith\*U},
  5605. .LP
  5606.     \ title
  5607.     \*QDirector\*U,
  5608. .LP
  5609.     \ number
  5610.     51,
  5611. .LP
  5612.     \ dateOfHire
  5613.     \*Q19710917\*U,
  5614. .LP
  5615.     \ nameOfSpouse
  5616.     {givenName \*QMary\*U,initial \*QT\*U,familyName \*QSmith\*U},
  5617. .LP
  5618.     \ children
  5619. .LP
  5620. \ \ {{{givenName \*QRalph\*U,initial \*QT\*U,familyName \*QSmith\*U},
  5621. .LP
  5622. \ \ \ \ \ dateOfBirth \*Q19571111\*U},
  5623. .LP
  5624. \ \ \ \ \ {{givenName \*QSusan\*U,initial \*QB\*U,familyName \*QJones\*U},
  5625. .LP
  5626. \ \ \ \ \ \ dateOfBirth \*Q19590717\*U}}}
  5627. .sp 1P
  5628. .LP
  5629. I.3
  5630.     \fIRepresentation of this record value\fR 
  5631. .sp 9p
  5632. .RT
  5633. .PP
  5634. The representation in octets of the record value given above (after applying 
  5635. the basic encoding rules defined in this Recommendation) is shown 
  5636. below. The values of identifiers, lengths, and the contents of integers are
  5637. shown in hexadecimal, two hexadecimal digits per octet. The values of the
  5638. contents of character strings are shown as text, one character per octet.
  5639. .bp
  5640. .RT
  5641. .ce
  5642. \fBH.T. [T12.209]\fR 
  5643. .ps 9
  5644. .vs 11
  5645. .nr VS 11
  5646. .nr PS 9
  5647. .TS
  5648. center box;
  5649. lw(31p) | lw(19p) | lw(24p) .
  5650. Personnel Record 60    . \fILength\fR 8185    . \fIContents\fR
  5651. .T&
  5652. lw(24p) | lw(19p) | lw(18p) | lw(19p) | lw(24p) | lw(19p) | lw(18p) .
  5653. Name    \fILength\fR    \fIContents\fR                  
  5654. .T&
  5655. lw(24p) | lw(19p) | lw(18p) | lw(19p) | lw(24p) | lw(19p) | lw(18p) .
  5656. 61    10                    
  5657. .T&
  5658. lw(24p) | lw(19p) | lw(18p) | lw(19p) | lw(24p) | lw(19p) | lw(18p) .
  5659.         Visible\(hyString    \fILength\fR    \fIContents\fR        
  5660. .T&
  5661. lw(24p) | lw(19p) | lw(18p) | lw(19p) | lw(24p) | lw(19p) | lw(18p) .
  5662.         1A    04    \*QJohn\*U        
  5663. .T&
  5664. lw(24p) | lw(19p) | lw(18p) | lw(19p) | lw(24p) | lw(19p) | lw(18p) .
  5665.         Visible\(hyString    \fILength\fR    \fIContents\fR        
  5666. .T&
  5667. lw(24p) | lw(19p) | lw(18p) | lw(19p) | lw(24p) | lw(19p) | lw(18p) .
  5668.         1A    01    \*QP\*U        
  5669. .T&
  5670. lw(24p) | lw(19p) | lw(18p) | lw(19p) | lw(24p) | lw(19p) | lw(18p) .
  5671.         Visible\(hyString    \fILength\fR    \fIContents\fR        
  5672. .T&
  5673. lw(24p) | lw(19p) | lw(18p) | lw(19p) | lw(24p) | lw(19p) | lw(18p) .
  5674.         1A    05    \*QSmith\*U        
  5675. .T&
  5676. lw(24p) | lw(19p) | lw(18p) | lw(19p) | lw(24p) | lw(19p) | lw(18p) .
  5677. Title    \fILength\fR    \fIContents\fR                
  5678. .T&
  5679. lw(24p) | lw(19p) | lw(18p) | lw(19p) | lw(24p) | lw(19p) | lw(18p) .
  5680. A0    0A                    
  5681. .T&
  5682. lw(24p) | lw(19p) | lw(18p) | lw(19p) | lw(24p) | lw(19p) | lw(18p) .
  5683.         Visible\(hyString    \fILength\fR    \fIContents\fR        
  5684. .T&
  5685. lw(24p) | lw(19p) | lw(18p) | lw(19p) | lw(24p) | lw(19p) | lw(18p) .
  5686.         1A    08    \*QDirector\*U        
  5687. .T&
  5688. lw(24p) | lw(19p) | lw(18p) | lw(19p) | lw(24p) | lw(19p) | lw(18p) .
  5689. Employee Number 42    . \fILength\fR 01    . \fIContents\fR 33                
  5690. .T&
  5691. lw(24p) | lw(19p) | lw(18p) | lw(19p) | lw(24p) | lw(19p) | lw(18p) .
  5692. Date of Hire A1    . \fILength\fR 0A    . \fIContents\fR                
  5693. .T&
  5694. lw(24p) | lw(19p) | lw(18p) | lw(19p) | lw(24p) | lw(19p) | lw(18p) .
  5695.         Date    \fILength\fR    \fIContents\fR        
  5696. .T&
  5697. lw(24p) | lw(19p) | lw(18p) | lw(19p) | lw(24p) | lw(19p) | lw(18p) .
  5698.         43    08    \*Q19710917\*U        
  5699. .T&
  5700. lw(24p) | lw(19p) | lw(18p) | lw(19p) | lw(24p) | lw(19p) | lw(18p) .
  5701. Name of Spouse A2    . \fILength\fR 12    . \fIContents\fR                
  5702. .T&
  5703. lw(24p) | lw(19p) | lw(18p) | lw(19p) | lw(24p) | lw(19p) | lw(18p) .
  5704.         Name    \fILength\fR    \fIContents\fR        
  5705. .T&
  5706. lw(24p) | lw(19p) | lw(18p) | lw(19p) | lw(24p) | lw(19p) | lw(18p) .
  5707.         61    10            
  5708. .T&
  5709. lw(24p) | lw(19p) | lw(18p) | lw(19p) | lw(24p) | lw(19p) | lw(18p) .
  5710.                 Visible\(hyString    \fILength\fR    \fIContents\fR
  5711. .T&
  5712. lw(24p) | lw(19p) | lw(18p) | lw(19p) | lw(24p) | lw(19p) | lw(18p) .
  5713.                 1A    04    \*QMary\*U
  5714. .T&
  5715. lw(24p) | lw(19p) | lw(18p) | lw(19p) | lw(24p) | lw(19p) | lw(18p) .
  5716.                 Visible\(hyString    \fILength\fR    \fIContents\fR
  5717. .T&
  5718. lw(24p) | lw(19p) | lw(18p) | lw(19p) | lw(24p) | lw(19p) | lw(18p) .
  5719.                 1A    01    \*QT\*U
  5720. .T&
  5721. lw(24p) | lw(19p) | lw(18p) | lw(19p) | lw(24p) | lw(19p) | lw(18p) .
  5722.                 Visible\(hyString    \fILength\fR    \fIContents\fR
  5723. .T&
  5724. lw(24p) | lw(19p) | lw(18p) | lw(19p) | lw(24p) | lw(19p) | lw(18p) .
  5725.                 1A    05    \*QSmith\*U
  5726. .T&
  5727. lw(24p) | lw(19p) | lw(18p) | lw(19p) | lw(24p) | lw(19p) | lw(18p) .
  5728. [3]    \fILength\fR    \fIContents\fR                
  5729. .T&
  5730. lw(24p) | lw(19p) | lw(18p) | lw(19p) | lw(24p) | lw(19p) | lw(18p) .
  5731. A3    42                    
  5732. .T&
  5733. lw(18p) | lw(19p) | lw(24p) | lw(19p) | lw(18p) | lw(19p) | lw(18p) .
  5734. Set    \fILength\fR    \fIContents\fR                
  5735. .T&
  5736. lw(18p) | lw(19p) | lw(24p) | lw(19p) | lw(18p) | lw(19p) | lw(18p) .
  5737. 31    1F                    
  5738. .T&
  5739. lw(18p) | lw(19p) | lw(24p) | lw(19p) | lw(18p) | lw(19p) | lw(18p) .
  5740.         Name    \fILength\fR    \fIContents\fR        
  5741. .T&
  5742. lw(18p) | lw(19p) | lw(24p) | lw(19p) | lw(18p) | lw(19p) | lw(18p) .
  5743.         61    11            
  5744. .T&
  5745. lw(18p) | lw(19p) | lw(24p) | lw(19p) | lw(18p) | lw(19p) | lw(18p) .
  5746.                 Visible\(hyString    \fILength\fR    \fIContents\fR
  5747. .T&
  5748. lw(18p) | lw(19p) | lw(24p) | lw(19p) | lw(18p) | lw(19p) | lw(18p) .
  5749.                 1A    05    \*QRalph\*U
  5750. .T&
  5751. lw(18p) | lw(19p) | lw(24p) | lw(19p) | lw(18p) | lw(19p) | lw(18p) .
  5752.                 Visible\(hyString    \fILength\fR    \fIContents\fR
  5753. .T&
  5754. lw(18p) | lw(19p) | lw(24p) | lw(19p) | lw(18p) | lw(19p) | lw(18p) .
  5755.                 1A    01    \*QT\*U
  5756. .T&
  5757. lw(18p) | lw(19p) | lw(24p) | lw(19p) | lw(18p) | lw(19p) | lw(18p) .
  5758.                 Visible\(hyString    \fILength\fR    \fIContents\fR
  5759. .T&
  5760. lw(18p) | lw(19p) | lw(24p) | lw(19p) | lw(18p) | lw(19p) | lw(18p) .
  5761.                 1A    05    \*QSmith\*U
  5762. .T&
  5763. lw(18p) | lw(19p) | lw(24p) | lw(19p) | lw(18p) | lw(19p) | lw(18p) .
  5764.         Date of Birth A0    . \fILength\fR 0A    . \fIContents\fR        
  5765. .T&
  5766. lw(18p) | lw(19p) | lw(24p) | lw(19p) | lw(18p) | lw(19p) | lw(18p) .
  5767.                 Date    \fILength\fR    \fIContents\fR
  5768. .T&
  5769. lw(18p) | lw(19p) | lw(24p) | lw(19p) | lw(18p) | lw(19p) | lw(18p) .
  5770.                 43    08    \*Q19571111\*U
  5771. .T&
  5772. lw(18p) | lw(19p) | lw(24p) | lw(19p) | lw(18p) | lw(19p) | lw(18p) .
  5773. Set    \fILength\fR    \fIContents\fR                
  5774. .T&
  5775. lw(18p) | lw(19p) | lw(24p) | lw(19p) | lw(18p) | lw(19p) | lw(18p) .
  5776. 31    1F                    
  5777. .T&
  5778. lw(18p) | lw(19p) | lw(24p) | lw(19p) | lw(18p) | lw(19p) | lw(18p) .
  5779.         Name    \fILength\fR    \fIContents\fR        
  5780. .T&
  5781. lw(18p) | lw(19p) | lw(24p) | lw(19p) | lw(18p) | lw(19p) | lw(18p) .
  5782.         61    11            
  5783. .T&
  5784. lw(18p) | lw(19p) | lw(24p) | lw(19p) | lw(18p) | lw(19p) | lw(18p) .
  5785.                 Visible\(hyString    \fILength\fR    \fIContents\fR
  5786. .T&
  5787. lw(18p) | lw(19p) | lw(24p) | lw(19p) | lw(18p) | lw(19p) | lw(18p) .
  5788.                 16    05    \*QSusan\*U
  5789. .T&
  5790. lw(18p) | lw(19p) | lw(24p) | lw(19p) | lw(18p) | lw(19p) | lw(18p) .
  5791.                 Visible\(hyString    \fILength\fR    \fIContents\fR
  5792. .T&
  5793. lw(18p) | lw(19p) | lw(24p) | lw(19p) | lw(18p) | lw(19p) | lw(18p) .
  5794.                 16    01    \*QB\*U
  5795. .T&
  5796. lw(18p) | lw(19p) | lw(24p) | lw(19p) | lw(18p) | lw(19p) | lw(18p) .
  5797.                 Visible\(hyString    \fILength\fR    \fIContents\fR
  5798. .T&
  5799. lw(18p) | lw(19p) | lw(24p) | lw(19p) | lw(18p) | lw(19p) | lw(18p) .
  5800.                 1    05    \*QJones\*U
  5801. .T&
  5802. lw(18p) | lw(19p) | lw(24p) | lw(19p) | lw(18p) | lw(19p) | lw(18p) .
  5803.         Date of Birth A0    . \fILength\fR 0A    . \fIContents\fR        
  5804. .T&
  5805. lw(18p) | lw(19p) | lw(24p) | lw(19p) | lw(18p) | lw(19p) | lw(18p) .
  5806.                 Date    \fILength\fR    \fIContents\fR
  5807. .T&
  5808. lw(18p) | lw(19p) | lw(24p) | lw(19p) | lw(18p) | lw(19p) | lw(18p) .
  5809.                 43    08    \*Q19590717\*U  
  5810. .TE
  5811. .nr PS 9
  5812. .RT
  5813. .ad r
  5814. \fBTable [T12.209], p.\fR 
  5815. .sp 1P
  5816. .RT
  5817. .ad b
  5818. .RT
  5819. .LP
  5820. .bp
  5821. .ce 1000
  5822. APPENDIX\ II
  5823. .ce 0
  5824. .ce 1000
  5825. (to Recommendation X.209)
  5826. .sp 9p
  5827. .RT
  5828. .ce 0
  5829. .ce 1000
  5830. \fBAssignment of object identifier values\fR 
  5831. .sp 1P
  5832. .RT
  5833. .ce 0
  5834. .PP
  5835. The following values are assigned in this Recommendation:
  5836. .sp 1P
  5837. .RT
  5838. .LP
  5839.     \fBClause\fR 
  5840.     \fBObject Identifier Value\fR 
  5841. .LP
  5842. \fBObject Descriptor Value\fR 
  5843. .LP
  5844.     25.2
  5845.     {joint\(hyiso\(hyccitt asn1 (1) basic\(hyencoding (1)}
  5846. .LP
  5847. \*QBasic Encoding of a single ASN.1 type\*U
  5848. \v'1P'
  5849. .ce 1000
  5850. APPENDIX\ III
  5851. .ce 0
  5852. .ce 1000
  5853. (to Recommendation X.209)
  5854. .sp 9p
  5855. .RT
  5856. .ce 0
  5857. .ce 1000
  5858. \fBIllustration of real value encoding\fR 
  5859. .sp 1P
  5860. .RT
  5861. .ce 0
  5862. .PP
  5863. III.1
  5864. A sender will normally examine his own hardware floating point
  5865. representation to determine the (value\(hyindependent) algorithms to be used to
  5866. transfer values between this floating\(hypoint representation and the length 
  5867. and contents octets of the encoding of an ASN.1 real value. This Appendix 
  5868. illustrates the steps which would be taken in such a process by using the
  5869. (artificial) hardware floating point representation of the mantissa shown in
  5870. Figure\ III\(hy1/X.209.
  5871. .sp 1P
  5872. .RT
  5873. .LP
  5874. .rs
  5875. .sp 10P
  5876. .ad r
  5877. \fBFigure III\(hy1/X.209, p.\fR 
  5878. .sp 1P
  5879. .RT
  5880. .ad b
  5881. .RT
  5882. .PP
  5883. It is assumed that the exponent can easily be obtained from the
  5884. floating point hardware as an integer value\ E.
  5885. .PP
  5886. III.2 
  5887. The contents octets which need to be generated for sending a
  5888. non\(hyzero value (as specified in the body of this Recommendation) are:
  5889. \v'6p'
  5890. .sp 9p
  5891. .RT
  5892. .sp 1P
  5893. .ce 1000
  5894. 1 S bb ff ee\ \ \ Octets for E\ \ \ Octets for N
  5895. .ce 0
  5896. .sp 1P
  5897. .LP
  5898. .sp 1
  5899. where S (the mantissa sign) is dependent on the value to be
  5900. converted, bb is a fixed value (say\ 10) to represent the base (in this 
  5901. case let us assume base\ 16), ff is the fixed\ F vaue calculated as described 
  5902. in 
  5903. \(sc\ III.3, and ee is a fixed length of exponent value calculated as described
  5904. in \(sc\ III.4 (this Appendix does not treat the case where E needs to exceed
  5905. three octets).
  5906. .bp
  5907. .PP
  5908. III.3 
  5909. The algorithm will transmit octets 1 to 5 of the hardware
  5910. representation as the value of N, after forcing bits\ 8 to\ 3 of octet\ 1 and
  5911. bits\ 4 to\ 1 of octet\ 5 to zero. The implied decimal point is assumed to be
  5912. positioned between bits\ 2 and\ 1 of octet in the hardware representation 
  5913. which delivers the value of\ E. Its implied position can be shifted to 
  5914. the nearest 
  5915. point after the end of octet\ 6 by reducing the value of\ E before
  5916. transmission. In our example system we can shift by four bits for every
  5917. exponent decrement (because we are assuming base\ 16), so a decrement of\ 
  5918. 9 will position the implied point between bits\ 6 and\ 5 of octet\ 6. Thus 
  5919. the value of M is N multiplied by\ 2\u3\d to position the point correctly 
  5920. in\ M. (The 
  5921. implied position\ N, the octets transferred, is after bit\ 1 of octet\ 5.) Thus
  5922. we have the crucial parameters:
  5923. .sp 9p
  5924. .RT
  5925. .LP
  5926. F\ =\ 3\ (so ff is 11)
  5927. .LP
  5928. exponent decrement = 9
  5929. .PP
  5930. III.4 
  5931. The length needed for the exponent is now calculated by working
  5932. out the maximum number of octets needed to represent the values
  5933. \v'6p'
  5934. .sp 9p
  5935. .RT
  5936. .ce 1000
  5937. E\dm\\di\\dn\u\ \(em\ excess\ \(em\ exponent decrement
  5938. .ce 0
  5939. .sp 1P
  5940. .ce 1000
  5941. E\dm\\da\\dx\u\ \(em\ excess\ \(em\ exponent decrement
  5942. .ce 0
  5943. .sp 1P
  5944. .LP
  5945. .sp 1
  5946. where E\dm\\di\\dn\uand E\dm\\da\\dx\uare minimum and maximum
  5947. integer values of the exponent representation, excess is any value which 
  5948. needs subtracting to produce the true exponent value, and the exponent 
  5949. decrement is as calculated in \(sc\ III.3. Let us assume this gives a length 
  5950. of 3\ octets. Then ee is\ 10. Let us also assume excess is zero. 
  5951. .PP
  5952. III.5 
  5953. The transmission algorithm is now:
  5954. .sp 9p
  5955. .RT
  5956. .LP
  5957.     a)
  5958.     test for zero, and if so, transmit an ASN.1 length of zero
  5959. (no contents octets) and end the algorithm;
  5960. .LP
  5961.     b)
  5962.     test and remember the mantissa sign, and negate the mantissa
  5963. if negative;
  5964. .LP
  5965.     c)
  5966.     transmit an ASN.1 length of 9, then
  5967. .ce 1000
  5968. 11101110\ \ if negative
  5969. .ce 0
  5970. .LP
  5971.     or
  5972. .sp 1P
  5973. .ce 1000
  5974. 10101110\ \ if positive
  5975. .ce 0
  5976. .sp 1P
  5977. .LP
  5978.     d)
  5979.     produce and transmit the 3 octet exponent with value
  5980. .sp 1P
  5981. .ce 1000
  5982. E \(em 9
  5983. .ce 0
  5984. .sp 1P
  5985. .LP
  5986.     e)
  5987.     zero bits 8 to 3 of octet 1 and bits 4 to 1 of octet 5, then
  5988. transmit the 5 octet mantissa.
  5989. .PP
  5990. III.6 
  5991. The receiving algorithm has to be prepared to handle any ASN.1
  5992. format, but here the floating point unit can be directly used. We proceed as
  5993. follows:
  5994. .sp 9p
  5995. .RT
  5996. .LP
  5997.     a)
  5998.     check octet 1 of the contents; if it is 1x101110 we have
  5999. a transmission compatible with ours, and can simply reverse the
  6000. sending algorithm;
  6001. .LP
  6002.     b)
  6003.     otherwise, for character encoding invoke standard character
  6004. decimal to floating point conversion software, and deal with a
  6005. \*QSpecialRealValue\*U according to the application semantics (perhaps
  6006. setting the largest and smallest number the hardware floating point
  6007. can handle);
  6008. .LP
  6009.     c)
  6010.     for a binary transmission, put N into the floating point
  6011. unit, losing octets at the least significant end if necessary, multiply
  6012. by 2\uF\d, and by B\uE\d, then negate if necessary. Implementors may
  6013. find optimisation possible in special cases, but may find (apart from
  6014. the optimisation relating to transmissions from a compatable machine)
  6015. that testing for them loses more than they gain.
  6016. .PP
  6017. III.7 
  6018. The above algorithms are illustrative only. Implementors will, of course, 
  6019. determine their own best strategies. 
  6020. .sp 9p
  6021. .RT
  6022. .LP
  6023. .bp
  6024. .LP
  6025. \fBMONTAGE:\ \fR PAGE 152 = PAGE BLANCHE
  6026. .sp 1P
  6027. .RT
  6028. .LP
  6029. .bp
  6030.